How to Get relative position?

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
sunnygraphy
Posts: 44
Joined: Mon Dec 05, 2005 8:15 am

How to Get relative position?

Post 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
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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.
anandh
Posts: 61
Joined: Thu Sep 14, 2006 12:40 pm
Contact:

Post by anandh »

Check with this you can get the distance btwn the 2 player
player1->getPosition().getDistanceFrom(player2->getPosition());

regards
anandh
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 players are children of the same parent node. As I said, you need to use getAbsolutePosition().
anandh
Posts: 61
Joined: Thu Sep 14, 2006 12:40 pm
Contact:

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