Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualfrob

Posted 28 June 2013 - 04:14 PM

An asside, if event.y=0 you have a divide by zero.

 

When you say "continues to rotate", I assume that is because you don't have anything that turns the rotation off.  You simply call postRotate every time, so the thing gets rotated every time. Is that intended?

 

Also, you don't give much context but I think you may want a turret that slowly rotates toward a touch.  You might be better off adjusting the angle by first taking the arrcos of the dot product between the normalized current direction and the normalized touch's direction, clamping that value to a maximum (so it moves slowly), and then using it for the rotation.


#1frob

Posted 28 June 2013 - 04:13 PM

An asside, if event.y=0 you have a divide by zero.

 

When you say "continues to rotate", I assume that is because you don't have anything that turns the rotation off.  You simply call postRotate every time, so the thing gets rotated every time. Is that intended?

 

Also, you don't give much context but I think you may want a turret that slowly rotates toward a touch.  You might be better off adjusting the angle by first taking the dot product between the current direction and the touch's direction, clamping that value to a maximum (so it moves slowly), and then using it for the rotation.


PARTNERS