Reputation: 332
So I am trying to make a program in Unity simulating a boats movement. This includes what happens when the boat collides with something. While the boat moves just fine, the heading values that I returns aren't in radians or degrees. Here is the code I am using to determine the Heading:
void getHdg()
{
float temp = this.transform.rotation.z;
craft.ChangeHeading(temp);
}
Every site that I went to suggested the use of Euler Angles, but from what I saw, they only update on a key press.
I need a way to either:
Upvotes: 2
Views: 3377
Reputation: 332
there are two issues with the code:
Here is the correct code:
void getHdg()
{
float temp = this.transform.eulerAngles.y;
craft.ChangeHeading(temp);
}
Upvotes: 3