Author Topic: Facing a player using their rotation (Solved)  (Read 624 times)

Using %player.setTranform(%pos SPC %rotation);, is there anyway trying to face a player using rotation?
« Last Edit: July 19, 2014, 08:01:45 PM by Advanced Bot »

Unfortunately, no. You have to create an aiplayer in place of them, have the aiplayer rotate, then swap it back to a player.

Yes, but only their yaw - you can't directly change their pitch.

function Player::turnToFace(%pl, %pos)
{
    %diff = vectorSub(%pos, %loc = %pl.getPosition());
    %ang = mAtan(getWord(%diff, 0), getWord(%diff, 1));
    %pl.setTransform(%loc @ " 0 0 1 " @ %ang);
}

All I needed was their yaw, thanks