Do I need a CollisionResponseAnimators for each node?

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
jun
Posts: 12
Joined: Thu Dec 07, 2006 5:00 pm

Do I need a CollisionResponseAnimators for each node?

Post by jun »

Currently I have made a class that holds an IAnimatedMeshSceneNode and an ISceneNodeAnimator. In the class I have the following function to attach a new CollisionResponseAnimator to the contained node. My question is, do I really need a separate animator for each node to handle the gravity like I am doing now, or can I just make a global animator and add it to every node with m_node.AddAnimator(global_animator)??

Code: Select all

class mynode
{
 private Irrlicht.Scene.IAnimatedMeshSceneNode m_node = null;
 private ISceneNodeAnimator m_animator = null;        

 public bool attachAnimator(ISceneManager smgr, ITriangleSelector selector)
 {
   m_animator = smgr.CreateCollisionResponseAnimator(
       selector, m_node, new Vector3D(60, 100, 60),
       new Vector3D(0, -0.088f, 0),
       new Vector3D(0, 0, 0), 0.0005f);
    m_node.AddAnimator(m_animator);
    return true;
 }
 .....
}
bgsteffens
Posts: 39
Joined: Wed Oct 04, 2006 8:00 am

Post by bgsteffens »

Only way to know for sure, try it out :P

If it doesn't work, you could still just derive from IAnimatedMesh and add the code to setup collision detection right into the constructor.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

:roll: yes u can but not with the same way u say it!!! my mind is closed now i cant haaam but yes u can !
jun
Posts: 12
Joined: Thu Dec 07, 2006 5:00 pm

Post by jun »

Well, I just tried it, and I don't think I can. The second argument of CreateCollisionResponseAnimator is a scene node, so you must have to make one for every scene node.
Post Reply