#How do I get the 2d rotation angle in radians of a Transform?

26 messages · Page 1 of 1 (latest)

cold scarab
#

I've tried using transform.rotation.to_axis_angle() and transform.rotation.z, but neither returns radians.

#

I've tried multiplying transform.rotation.z by PI but that also leads to weird values

amber patrol
#

to_axis_angle() claims to be in radians

cold scarab
#

so 181 becomes 179

#

and 179 is still 179?

amber patrol
#

add tau/2?

cold scarab
#

no like

#

hmm

#

i think i miswrote

#

180 = 0

#

it returns the same for both 180 and 0

amber patrol
#

is the rotation axis inverted

cold scarab
#

despite facing opposite directions

amber patrol
#

(hypothesis) like in one case the axis is Vec3::Z and in the other it's Vec3::NEG_Z

cold scarab
#

I'll give it a test

#

facing left side gives this

#

facing right side gives this

#

so yup!

#

This works!

#

but

#

it feels like a really janky way just to get the angle lol

amber patrol
#

I think it's trying to find the axis which gives the mimum angle

#

why it does that idk

cold scarab
#

yeah it's quite strange