Vector<---i am always wrong..
by Kenny · in Torque Game Builder · 03/03/2007 (6:28 am) · 1 replies
Function Enemy::Move(%this,%vx,%vy)
{
%this.setLinearVelocity(%vx, %vy);
%theAngle=t2dAngleBetween(%vx 0,0 %vy);
%this.setRotation(%theAngle/2);
echo(%theAngle);
}
what;s wrong with that script above?
i try to get angle between x y vector ,then rotate the ship to let it face the right direction.
t2dAngleBetween(%vx 0,0 %vy); <---it's always wrong. i don;t know why.
{
%this.setLinearVelocity(%vx, %vy);
%theAngle=t2dAngleBetween(%vx 0,0 %vy);
%this.setRotation(%theAngle/2);
echo(%theAngle);
}
what;s wrong with that script above?
i try to get angle between x y vector ,then rotate the ship to let it face the right direction.
t2dAngleBetween(%vx 0,0 %vy); <---it's always wrong. i don;t know why.
Associate Tom Eastman (Eastbeast314)
Hopefully that'll work - it might return in radians too, so you should convert it before using it to set the Rotation.
Hope that helps!