Snooker Game

josericardo_jr

20-06-2006 16:59:38

Hi,

I'm trying to make a snooker game using Ogre + Newton. But I have a question: how I know the position the parquet block touch my ball to make right impulse in the right direction? If I simple add an impuse in the ball, it maybe go to the wrong direction. My parquet block maybe not touch my ball in the centre.

Does anyone could help me?

Thanks a lot

Ricardo

abecam

20-06-2006 20:28:06

You can add a local force, from the doc:


void OgreNewt::Body::addLocalForce ( const Ogre::Vector3 & force,
const Ogre::Vector3 & pos
)


this function is only valid inside a ForceCallback function!

Parameters:
force vector representing force, in local space of the body
pos vector representing locatino of force, in local space of the body


So you might just have to calculate first where to add the force (intersection with a line and a circle, quite fast to calculate if I remember well), then add the impulsion in the right place.

josericardo_jr

26-06-2006 14:06:42

Hi abecam,

Thanks for you help. I'll try it.

Ricardo