Page 1 of 1

How to Get relative position?

Posted: Tue Sep 26, 2006 4:00 am
by sunnygraphy
Hi..

I have two separate characters.
And I want to know where each other are located from each other.
They are not parent and child relation.

But I could not find funtion for finding relative position.


thanks

Posted: Tue Sep 26, 2006 5:18 am
by vitek
Each node has a world position that you can get by calling getAbsolutePosition(). This can be used to compare absolute positions of nodes. You can use a nodes absolute transform to rotate the world space vector between the two nodes so you have the vector in node space.

Posted: Thu Sep 28, 2006 5:50 am
by anandh
Check with this you can get the distance btwn the 2 player
player1->getPosition().getDistanceFrom(player2->getPosition());

regards
anandh

Posted: Thu Sep 28, 2006 5:56 am
by vitek
That only works if the two players are children of the same parent node. As I said, you need to use getAbsolutePosition().

Posted: Thu Sep 28, 2006 6:31 am
by anandh
This is fine.
Iam having problem in collision plz check this

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15918

Can u help me how to detect the collision using ID value.
regards
anandh