Object pass through the wall

supermael

21-11-2010 11:10:53

Hello !
I've got a problem with NxOgre in my game. The player can fire bullets, which are a Critter::Body with a fast velocity created like that :
mpv_Body->addForce(NxOgre::Vec3(10000, 0, 0), NxOgre::Enums::ForceMode::ForceMode_Force);

This body is a cube 1x1x1, but sometimes it pass through the wall, I've even done :
mpv_PhysicWorld->setCCDEnabled(true);

What can I do to resolve this problem ?

betajaen

21-11-2010 11:40:22

You don't normally give that amount of force to a bullet. And I would normally use rays for their accuracy.

To answer your question; you need a cooked CCD Skeleton and pass it to the skeleton pointer in the BoxDescription.

supermael

21-11-2010 12:07:37

I'm making an arcade game, I'm not sure using ray is the good solution, I'm going to limit the speed of the bullets, and it wiil be ok. Thank you for your answer !

spacegaier

21-11-2010 12:10:19

I'm going to limit the speed of the bullets
Isn't that depending on the speed the game runs on the given hardware? I thought that the limit would vary from PC to PC...

supermael

21-11-2010 12:18:38

No, the game don't run faster on a better computer than on a normal, the framerate is limited, and the game takes care of the time between two frames.