point towards

Posted By: dakilla

point towards - 05/16/09 16:22

is there a way to make one entity pan towards another entity?
Posted By: Quad

Re: point towards - 05/16/09 16:53

yes,find direction vector from target entity to looking entity (vec_sub their positions)

then use vec_to_angle to convert that vector to angle. use the pan of resulting angle.
Posted By: dakilla

Re: point towards - 05/16/09 16:55

kk, thanks
Posted By: Jaxas

Re: point towards - 05/16/09 18:56

Code:
function turn_towards_target()
{
  // get the direction from the entity MY to the entity YOU
  vec_set(temp,your.x); 
  vec_sub(temp,my.x);
  vec_to_angle(my.pan,temp); // now MY looks at YOU
}

from manual..again..
Posted By: Eagelina

Re: point towards - 05/17/09 13:21

Go and download and read AUM 72,
in the unanswered question the last one, is a great code that works as you whant.
© 2024 lite-C Forums