Hi,
I i currently make a switch from unity to unreal.
I don’t find equivalence of Vector3.SignedAngle() in Unreal, that a function that really help me to handle rotation … this function calculate the angle between an A vector to B vector with axis Vector. The axis vector is important to handle sign of angle.
my problem : I want to clamp rotation of an element -90° → 45° and i don’t know how to do this without this function equivalence …
1st vector is the direction of lever from the base of it
2nd vector is the direction from the base of lever to Hand position (VR hand)
My objective is to compute angle from two vectors to add this angle to lever rotation, sign permit me to determine the direction of angle. To make this calculation in Unity I use the function I said before: Vector.signedAngle(Vector from, Vector to, Vector axis).
Give my first Vector as “from” and second vector as “to” and lever axis direction as “axis”. “axis” is the referencial to compute the sign of angle. With sign, when the VR hand push the lever, the angle will be negative, and when she pull the lever, it will be positive.
other application is to get current angle of lever (to trigger events or clamp positions) by compute the angle between initial lever direction and current by the same way. If I do a Dot product and Acos and the calculation gave me 170 as result, I don’t know if it’s 170° or 190° (360° -170°)
Apparantly, with couple of days of search, a simple function to achieve this calculation don’t exists on Unreal, that a engine weakness (vector and angle calculation in general).
Ho Wow ! looks like a pretty good and stable solution !
Thx a lot for your proposition, I think it will help not only me !
Since I post my message on this forum, I succeeded to setting up a solution that’s work in my case but not realy stable. When I reach the final Milestone of my project , I will try to patch my script to implement this solution !
PS: sorry for my english, it’s not my native language, I hope I did not make lot of language mistakes)
PS2: I just check the post you linked bellow your reply, congratulations for your explications, very pedagogical approach !