Game Development Community

Vector problems...

by Stephane Savioz · in Torque Game Engine · 08/13/2005 (3:40 am) · 1 replies

I have a vector problem, I am not good with vectors calculation.

I want to display on screen an arrow indicator (like in the Crazy Taxi game), I want this arrow to show me the way to a house.


What I've tried to do is calculate a vector from the player position to a static object (the house).

What I've done so far :


%playerPos = $Player.GetTransform();
%homePos = home.GetTransform();

%vectorPlayerPositionToHouse = VectorSub(%homePos, %playerPos); //gives the vector from the player position to the house



This works as long as the Player.forwardVector = 0,1,0.


If I turn back (forwardVector 0,-1,0), then %vectorPlayerPositionToHouse still returns the
vector from the player position to the house, this is correct because the player has not moved, but this is not what I want.


I want the arrow to show the correct way to the house depending on the point of view of the player and not his position.



Can somebody help please, I'm getting crazy

#1
08/13/2005 (4:27 am)
You could try getting the angle between the vectors then have the arrow rotate..