Mouse click force

kurisusan

08-06-2010 14:31:11

Hi,

I would like to simulate a force being applied by clicking the mouse, so i can knock something over upon clicking on it (in this case a domino)

if( ms.buttonDown( OIS::MB_Left ) ){

Ogre::Entity *selEnt= NULL;
Ogre::Vector3 result = Ogre::Vector3::ZERO;
float distToColl;

if (mCollisionTools->raycastFromCamera(mWindow, mCamera, Ogre::Vector2(ms.X.abs, ms.Y.abs), result, selEnt, distToColl, MOVEABLE_MASK))
{
if(firstDomino->GetEntity() == selEnt){
Vector3 unitVector = result;
unitVector.normalise();

firstDomino->addForceAtPos(Vector3(10,10,10) * unitVector, result);
}

}
}





are there any threads or tutorials anyone can point me to for this? Or any advice would be much appreciated

Cheers

kurisusan

08-06-2010 14:51:49

oops ... found out where i was going wrong..

was supposed to be

mCamera->getDirection();

instead of

Vector3 unitVector = result;
unitVector.normalise();

as that would be from 0. doh!