Toggling Collision off and on with button?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Valor
Posts: 40
Joined: Fri Jul 30, 2010 1:20 pm

Toggling Collision off and on with button?

Post 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?
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

Remove the animator and recreate it each time.
#include <Iyad.h>
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post 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.
Post Reply