- If gravity is too small, the camera doesn't fall at all.
- If I set gravity to -5 or so, the camera falls, but after it hits the ground it can't move (aside from shifting around .0001 unit or so). It's almost as if my planet is made of industrial strength glue which dries as soon as you touch it.
- The camera's X position seems to be changing of its own will. I don't have anything in my code to change it, yet by the time I fall to the planet it goes from 0 to 1.77. Z doesn't change at all.
- If too much of the ground goes out of the window, the whole thing will disappear. Is this some kind of culling, and can I turn it off?
My code (apologies for long post, but pastebin wasn't cooperating and told me I was attempting to do SQL injection or some crap):
Code: Select all
#include <Main.hpp>
int main()
{
device = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600), 32, false, true, false);
if (!device) return 1;
device->getFileSystem()->addFolderFileArchive("data/");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
IAnimatedMesh* world = smgr->getMesh("models/planets/flat.x");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(world);
camera = smgr->addCameraSceneNodeFPS(NULL, 100.0, 5.0);
camera->setPosition(vector3df(0, 10, 0));
ITriangleSelector* selector = smgr->createTriangleSelector(world, node);
node->setTriangleSelector(selector);
ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, camera, vector3df(5, 5, 5),
vector3df(0, -5, 0), vector3df(0, 0, 0));
camera->addAnimator(anim);
anim->drop();
device->setWindowCaption(L"");
device->getCursorControl()->setVisible(false);
sun = smgr->addLightSceneNode(NULL, vector3df(50, 50, 50), SColor(255, 128, 128, 64));
IGUIStaticText* fpslabel = guienv->addStaticText(L"", rect<int>(10, 10, 200, 32), true);
fpslabel->setDrawBorder(false);
fpslabel->setOverrideColor(SColor(255, 255, 255, 0));
int fps, last_fps = -1;
while(device->run())
{
driver->beginScene(true, true, SColor(0, 0, 0, 24));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
vector3df pos = camera->getPosition();
fps = driver->getFPS();
if (fps != last_fps)
{
stringw s = stringw(fps) + L" FPS, X=" + stringw(pos.X) + " Y=" + stringw(pos.Y) + " Z=" + stringw(pos.Z);
fpslabel->setText(s.c_str());
last_fps = fps;
}
}
device->drop();
return 0;
}
