Page 1 of 1
Toggling Collision off and on with button?
Posted: Thu Sep 09, 2010 7:16 pm
by Valor
Could someone tell me how to modify the code so that I can turn off the collision and turn it back on using a button? What would be the best way to toggle collision code wise?
Posted: Thu Sep 09, 2010 8:52 pm
by Iyad
Remove the animator and recreate it each time.
Posted: Thu Sep 09, 2010 10:27 pm
by Luben
Check example/tutorial #12 Terrain Rendering for how to react on keypresses, or #05 if you'r talking about gui buttons.
Code: Select all
//! Should the Target react on collision ( default = true )
virtual void setAnimateTarget ( bool enable ) = 0;
virtual bool getAnimateTarget () const = 0;
These are member functions of the
ISceneNodeAnimatorCollisionResponse interface (the animator returned from
createCollisionResponseAnimator). By toggling this value, you dont need to recreate the animator all the time.