Hello. I'm using the terrain example to try out different things for irrlicht and stuff, but I don't like how the camera just "flys" around. I would like the player to stay on the ground instead of going wherever the cursor points.
I'm really new to Irrlicht, so could you please explain where the codes go in the example and such?
Thanks!
"Gravity" in the terrain example?
-
NexusInteractive
- Posts: 33
- Joined: Sun Jun 26, 2005 4:41 pm
try something like this:
hope that helps..
Code: Select all
// set the camera scenenode...
scene::ICameraSceneNode* camera;
camera = smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
camera->setPosition(core::vector3df(10,100,10));
// load the "gravity"-animator...
scene::ISceneNodeAnimator* animator = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-100,0), // 100.0f,
core::vector3df(0,50,0));
camera->addAnimator(animator); // <- gravity (!!)
animator->drop();
-
NexusInteractive
- Posts: 33
- Joined: Sun Jun 26, 2005 4:41 pm
Well, I tried and nothing happens. I don't get any errors and there isn't any gravity... Here's what I have:
Any ideas?
Code: Select all
// add camera
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0,100.0f,1200.0f);
camera->setPosition(core::vector3df(1900*2,255*2,3700*2));
camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
camera->setFarValue(12000.0f);
// load the "gravity"-animator...
scene::ISceneNodeAnimator* animator = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-100,0), // 100.0f,
core::vector3df(0,50,0));
camera->addAnimator(animator); // <- gravity (!!)
animator->drop();-
NexusInteractive
- Posts: 33
- Joined: Sun Jun 26, 2005 4:41 pm
Okay, I put it in the wrong place. It works okay now. I also had to change core::vector3df(0,50,0)); to core::vector3df(0,100,0)); becuase the camera kept bouncing up and down. But now, when I go up a hill, the camera bounces slightly and i slide back down. Would it be possible to make it not do that?
Computer Specs:
AMD Duron 1.8 GHZ + 256 MB RAM + ATI Radeon 7000 Series + 20gig HDD + PCChips K7 MotherBoard
AMD Duron 1.8 GHZ + 256 MB RAM + ATI Radeon 7000 Series + 20gig HDD + PCChips K7 MotherBoard