Irrlicht and Tumle camera rotation problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Iaro
Posts: 45
Joined: Sat Feb 05, 2005 7:01 am

Irrlicht and Tumle camera rotation problem

Post by Iaro »

Hello,

I have a problem. For an older project I've been using the Tumle physics wrapper. Recently I've recompiled the project using the SVN version of Irrlicht, and now the Tumle physics FPS camera doesn't work correctly anymore. I can translate the camera, but rotation doesn't work. Were there any large changes made to the Irrlicht FPS camera node between 1.4 and SVN revision 1471 relating to rotation? I'd rather keep using Tumle for this application, but if not I've been thinking about switching to IrrNewt. When compiling IrrNewt from SVN, the dll is created normally, but when creating the lib, it weights almost 18 MB. Is this normal, or am I doing something wrong with the compiler (VC) settings?

Thanks in advance.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can use the 1.4 branch from SVN, which doesn't have too many changes compared to 1.4.1. The SVN trunk is rather different, because it's the upcoming 1.5 development repoistory. The cameras have been changes to scene node animators, which introduced several changes.
Iaro
Posts: 45
Joined: Sat Feb 05, 2005 7:01 am

Post by Iaro »

Ok, thank you. I've also been experimenting with irrNewt and managed to compile it using the Irrlicht SVN version. For anyone else interested in this: use the irrNewt svn version source files and includes copied over the normal (0.4) version, and the project should compile after a small modification to the round function - fix here.
Iaro
Posts: 45
Joined: Sat Feb 05, 2005 7:01 am

Post by Iaro »

A little update:
I managed to get the camera to rotate, by calling OnEvent for the camera node which in turn sends the event to the ISceneNodeAnimatorCameraFPS of the camera. So now the camera can move and rotate.

A problem persists though: translation is not made along the camera direction, but rather for the initial direction (I think). Looking through the tumle code in the newton callback (newtonForceAndTorqueCallback):

Code: Select all

 //get the current velocity
f32 cv[3];
NewtonBodyGetVelocity(cPNode->getNewtonBody(), cv);

//rotate the desired velocity relative to the node
core::vector3df dv = cPNode->getDesiredVelocity();
cPNode->getIrrlichtNode()->getRelativeTransformation().rotateVect(dv);

//calculate the force needed to move the node
core::vector3df newForce = ( dv - core::vector3df(cv[0],0,cv[2]) ) * cPNode->getMass();
Is the getRelativeTransformation line correct, or does camera rotation now work differently with animators?

Another thing I found in the engine source is the animateNode function. Maybe calling this before the physics update fuction will solve the problem, but i don't know exacly how to access it.

This:

Code: Select all

ISceneNode *node = physicsCam->getIrrlichtNode();
node->getAnimators().begin()->animateNode(node,device->getTimer()->getTime());
doesn't work.
Post Reply