How to use the rotation of a marker to adjust gravity or apply force

Feb 8, 2010 at 6:55 PM

I am working on a project similar to the labyrinth marble game.  I am attempting to change either the direction of gravity or the direction of a force according to the tilt of the markers.

I am stuck trying to convert the rotation (quaternion) into the proper direction (vector3).  I'm sorry, but my physics isn't very good.

I can get the rotation of a markenode via markerNode.WorldTransformation.Decompose(out markerScale,out markerRot, out markerTrans);.  However, I'm not sure how to use this resulting quaternion.  Can someone point me in the right direction?

The end result i want is either the proper direction of gravity or the direction to apply a force to the marble so it will roll in the expected direction (needing a vector3 when all is said and done).


Feb 8, 2010 at 8:55 PM

Update:  I got this working when the camera is directly above the ground marker.  My problem was trying to "zero-out" the angle of the camera when it was at a different angle.  I've given up that idea  - when assuming the camera is overhead, all is well.

May 19, 2011 at 11:54 PM

Can you maybe post the code? I'm really curious how you made it, cause I'm out of ideas :)