Author Topic: Facing a position [Solved]  (Read 477 times)

Does anyone know how to make a player face to a position? I used to have the function but I lost it but I can't really figure it out.

Nevermind, I found it on one of my scripts, it was a challenge to find it though.

If anyone needs it:
Code: [Select]
function Player::turnToFace(%pl, %pos)
{
%loc = %pl.getPosition();
%diff = vectorSub(%pos, %pl.getPosition());
%ang = mAtan(getWord(%diff, 0), getWord(%diff, 1));
%pl.setTransform(%loc @ " 0 0 1 " @ %ang);
}
« Last Edit: November 23, 2015, 04:45:38 PM by Kyuande »