Beta 2 rotateTo not stopping
by Bryce Bangerter · in Torque Game Builder · 04/12/2006 (7:06 pm) · 1 replies
I have a player that climbs up walls over the top and then down other side. I have a function that rotates the player so his 'feet' are always facing the current surface.
%dir will only ever have values of 0, 1 or -1. 1 and -1 work fine. 0 though will *sometimes* leave the player stuck endlessly spinning.
At first I thought that this only occured if the player was already spinning to a new orientation when the function got called again to set the player 'upright'. Further testing though has shown it seems to be completely random :(.
I have also tried lowering the rotation speed (down to 90) and increasing the targetMargin (up to .5).
function RotatePlayer (%dir)
{
$player.orientation = %dir;
$player.rotateTo (-90 * %dir, 720);
}%dir will only ever have values of 0, 1 or -1. 1 and -1 work fine. 0 though will *sometimes* leave the player stuck endlessly spinning.
At first I thought that this only occured if the player was already spinning to a new orientation when the function got called again to set the player 'upright'. Further testing though has shown it seems to be completely random :(.
I have also tried lowering the rotation speed (down to 90) and increasing the targetMargin (up to .5).
Torque Owner Michael Woerister
http://www.garagegames.com/mg/forums/result.thread.php?qt=41995