cameraFPS question
cameraFPS question
the camera is in FPS mode,how to get the camera's postion in real time,
I used camera->getPostion() int function device->run(),but it crashes when the game begin.
I used camera->getPostion() int function device->run(),but it crashes when the game begin.
if I code: cameraFPS->removeAnimator(collider);JP wrote:Do you mean effectively teleporting the camera from one position to another which is quite far away?
If so then yes the collision response animator will prevent this from being completed.
So what you have to do is remove the animator, move the camera and then readd the animator.
cameraFPS->setPosition(core::vector3df(630,370,1053));
it works well, but collision occurs when I wrote this:
cameraFPS->removeAnimator(collider);
cameraFPS->setPosition(core::vector3df(630,370,1053));
cameraFPS->addAnimator(collider);
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Ze updates, ze do nuzzink!
You'll need to trick the animator into updating its LastPosition without actually doing an animation. There's no direct access to it, but by fortunate happenstance, calling animateNode() with a changed node does the trick. So we call it twice, once with a 0 node, then again with the original node. There's no need to remove and re add the animator. Job's a good 'un.
You'll need to trick the animator into updating its LastPosition without actually doing an animation. There's no direct access to it, but by fortunate happenstance, calling animateNode() with a changed node does the trick. So we call it twice, once with a 0 node, then again with the original node. There's no need to remove and re add the animator. Job's a good 'un.
Code: Select all
cameraFPS->setPosition(core::vector3df(630,370,1053));
collider->animateNode(0, device->getTimer()->getTime());
collider->animateNode(cameraFPS, device->getTimer()->getTime());
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
It Works For Me, at least with the SVN trunk (I rarely post untested code), so perhaps if you post more of your source, or define in what way it's not working for you, we can puzzle out what's going on.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Code: Select all
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_KEY_T &&
event.KeyInput.PressedDown == true)
{
cameraFPS->setPosition(core::vector3df(630,370,1053));
collider->animateNode(0, device->getTimer()->getTime());
collider->animateNode(cameraFPS, device->getTimer()->getTime());
}
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Oops, I'm very sorry.
CSceneNodeAnimatorCollisionResponse::animateNode() has been changed since 1.4. That method will only work with the SVN trunk version.
Hmm, let's see...
Nope, sorry, the only way that I can see it working with 1.4 is to remove the old collision animator and create and attach a brand new one each time you do the teleport.
Alternatively, you could update to using the SVN trunk and use the workaround above. I'd recommend it; you get all the best toys.
CSceneNodeAnimatorCollisionResponse::animateNode() has been changed since 1.4. That method will only work with the SVN trunk version.
Hmm, let's see...
Nope, sorry, the only way that I can see it working with 1.4 is to remove the old collision animator and create and attach a brand new one each time you do the teleport.
Alternatively, you could update to using the SVN trunk and use the workaround above. I'd recommend it; you get all the best toys.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
You could probably (definitely) find tutorials in either the FAQ section of this forum or in the wiki, but another alternative is to use the Irrlicht Nightly Builds website. Once you download that, you just have to open the project that matches your IDE (under irrlicht\source\irrlicht\), configure the Irr Compile Config file, and hit compile.