hehe check this stuff out
given:
Code: Select all
// disable mouse cursor
device->getCursorControl()->setVisible(false);
// add billboard
scene::IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialTexture(0, driver->getTexture("media/textures/particle.bmp"));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setSize(core::dimension2d<f32>(20.0f, 20.0f));
ok so we have a billboard and we have turned off the mouse pointer ok?
now, in the rendering loop, do this:
Code: Select all
core::vector3df intersection;
core::triangle3df tri;
//!get a ray from the current mouse position
ray = smgr->getSceneCollisionManager()->getRayFromScreenCoordinates(device->getCursorControl()->getPosition());
if (smgr->getSceneCollisionManager()->getCollisionPoint(ray, selector, intersection, tri)){
bill->setPosition(intersection);
lastCursorPosition = core::vector3df(intersection.X,0,intersection.Z);//ignore the y coord
}
so now what we have is a cute little billboard that doesnt point where the camera is looking, but where the _mouse_ is pointing in 3d. the purpose of this of course, is that that vector, lastCursorPosition, now contains the x and z of the last spot _on_the_ground_ where the cursor pointed, so now if we then go in our event receiver and watch for clicks from the mouse, we can, on a click, tell the "player" to then set lastCursorPosition as a destination they should go to, using something like opensteer to guide them
this, (plus a lot of other stuff i have yet to do) should allow me to have character movement like NWN in Fmorg