Hi!
I’m currently makling a discgolf game, and getting the angle of attack of the frisbee is essential to make realistic physics.
But I’m currently struggling to calculate the AOA. I’m using an empty gameobject which forces like lift and drag is applied to. And for AOA / nose angle I’m using another gameobject(also acting as the disc body) parented to the empty gameobject, this allows it to be rotated differently on the x-axis compared to the empty gameobject and making it possible to throw the disc with different nose angles.
Using this code:
aoa = Vector3.SignedAngle(axisRB.velocity, aoaVector.transform.forward, discAxis.transform.right);
axisRB => RigidBody component attached to the empty gameobject
aoaVector => Disc body, simply the nose angle of the frisbee
discAxis => Empty gameobject(the one which forces like lift and drag is applied to)
The AOA is not consistent, sometimes it varies between huge numbers like -100 and 100 in just a second which makes the disc fly away extremely fast when calculating forces based on the AOA.
I know it might be hard to understand my description, so if clips and more code is needed I can provide that. But my question is if Unity is capable of calculating the angle between two different object at all, or if I’m making the mistake?
Thanks in advance!
//Hugo