How to detect if an object had fallen over??

paulm12

26-01-2007 14:54:25

I've been trying to detect if an object has fallen over, i.e in comparison to it's starting position. I've been trying to use the global orientation value to determine this.... but no success. Does anyone have any suggestions?

betajaen

26-01-2007 15:12:50

That would be the easiest way. Can I ask what does your code look like?

paulm12

26-01-2007 15:24:43

yeah, thanks for the reply...
Quaternion pinQuat = pin->getGlobalOrientation();
if (pinQuat.??<?)....


I've been messing around with that kind of idea.
The global orientation values are the following

-standing
{w=1.6570478e-038 x=0.99999857 y=2.0401121e-005 ...}

-fallen
{w=1.6570478e-038 x=0.50721496 y=0.50721711 ...}


I'm sorry if i'm being slow here! Thanks for your help!

betajaen

26-01-2007 16:24:55

Your almost there, however convert the Quaternions into Pitch and Roll, from there you can get the Degrees. Now just check if the Degree is different from from the initial.