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:
there are two issues with the code:
Here is the correct code:
void getHdg()
{
float temp = this.transform.eulerAngles.y;
craft.ChangeHeading(temp);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.