Distance between two nodes of the scene

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
george++
Posts: 16
Joined: Mon Sep 28, 2009 5:30 pm
Location: Hellas

Distance between two nodes of the scene

Post by george++ »

Because I have no experience at Irrlicht and I don't want to use code twice for the same thing, I am wondering if there is a function to retrieve the distance between two nodes of the scene or if there is a set of math functions for doing operations between matrices and/or vectors.

Thanks in advance
May the software be with you
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Hi,
You could try to use

distance=node1->getPosition().getDistanceFrom(node2->getPosition());
george++
Posts: 16
Joined: Mon Sep 28, 2009 5:30 pm
Location: Hellas

Post by george++ »

Thanks stefbuet :)
This is what I was looking for.
May the software be with you
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

That only works if the two nodes happen to be children of the same scene node. The expression node1->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition()) will avoid this limitation.

Travis
Post Reply