setCustomTransformCallback ?

nikhil

02-03-2007 07:45:45

setCustomTransformCallback()??

Just curious, what is this used for??


nik

walaber

02-03-2007 15:38:09

when you attack an Ogre Node to a rigid body, it turns on a default callback inside OgreNewt that automatically updates the location, and orientation of that Ogre Node each time you call update() on the world, and that particular Body moves.

that's why the visual objects update themselves automatically in all of the demos, etc.

for simple rigid bodies that only have 1 ogre Node attached, the default is sufficicient. but in other uses, you might want to put your own code in there, each time the rigid body moves. examples of this are:

1. my custom ragdoll class. I use a custom callback here to align the skeleton bone I have attached to that particular rigid body.

2. in Stunt Playground, each object has a recording system for creating replays. I used this callback to enter new keyframes for each object's recording. The advantage here is that if an object doesn't move, the callback is never called, so the keyframes are very efficient, because they only get added when the object is moving / rotating.

check the source for the above examples for more if you are interested.