What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Help with using turn() with angle()

Status
Not open for further replies.

user01

Member
Joined
Sep 19, 2014
Messages
71
Reaction score
0
I am having difficulty being able to turn and face the direction of the angle() returned. I know angle() returns the angle in degrees and turn() is basically calculated in radians. But I just can't get them to work together. Does anyone have a snippet of code that shows me how this is done?

Thanks,
user
 
I am having difficulty being able to turn and face the direction of the angle() returned. I know angle() returns the angle in degrees and turn() is basically calculated in radians. But I just can't get them to work together. Does anyone have a snippet of code that shows me how this is done?

PHP:
var radians = degrees * Math.PI / 180.0;
var degrees = radians * 180.0 / Math.PI;

Here is my function for turning towards a world coordinate (which is strangely missing from the api):

PHP:
private void TurnTowards(double x, double y)
{
            Turn(((Math.PI / 180) * Math.Abs(360 - angle(x, y))));
}
 
Thank you very much. That is EXACTLY what I was looking for :D
 
Status
Not open for further replies.
Back
Top