Bullet Physics Character Controller

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
cyberpunkpor
Posts: 9
Joined: Thu Oct 25, 2007 10:03 am

Bullet Physics Character Controller

Post by cyberpunkpor »

Hi

i am trying to apply some physics to my model. My main interest is to provide a way to the character to run and turn around it self.

For now i only use applyForce to move the player:

core::vector3df followPos = Camera->getAbsolutePosition();
core::vector3df d = followPos - currentPos;
d.setLength(pManager->getKey(irr::KEY_KEY_S) ? force : -force);
playerAnimator->applyForce(d);

The problem is that i want to rotate the player model being able to, for example, if i press <- and the model is facing -> it turns automatically to <- and the force is applied in that direction.

I want to control the character also without using the camera, since my camera is fixed and only follows the model around the soccer field. So the rotation should allways be on the model and not in the camera.

Can you provide me some code on how to control the player? Or some documentation please?

Also, there is any source code example about callback notification on a collision made by two rigid body's on Bullet? The demo of Irrlicht with BUllet seems to provide none.

Thanks

PS: here is the model and the field:

http://irrlicht.sourceforge.net/phpBB2/ ... wtopic&f=1

Thanks.
cyberpunkpor
Posts: 9
Joined: Thu Oct 25, 2007 10:03 am

Post by cyberpunkpor »

After debuging a little bit my application i found that setting a value for the rotation gives me completely different values:

playerAnimator->setRotation(vector3df(0.0,1.0,1.0));


vector3df check = playerAnimator->getRotation();

printf("Object: GET AFTER SET (0,1,1) X: %lf, Y - %lf, Z - %lf\n", check.X, check.Y, check.Z);


The debug ouput is:

Object: GET AFTER SET (0,1,1) X: -0.000025, Y - 229.183121, Z - 229.183090

How this is possible? Is any related to the conversion to Euler?

I am using Bullet Animator source code:

http://irrlicht.sourceforge.net/phpBB2/ ... etanimator

can anybody point me some solution?

THanks
Post Reply