Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: RobotGoggles on February 23, 2020, 11:21:04 PM
-
So I'm trying to compare the angle of two objects and call an event if they're equal within a certain range. Vector3 Compare sort of works, but it doesn't account for objects that are below zero, since the rotation values jump from 359 back to 0 so there are negative numbers.
I could get the raw rotation values to get negative rotation, but then I won't be able to account for objects that have been rotated multiple times.
Surely there must be a simple way to do this?
-
Hi,
unfortunatly, no, there isn't a simple solution for this, quaternions and euler angles are complex math, but there are some custom actions that wrap the complexity.
check out "GetSignedAngleToTarget" custom action on the ecosystem, that will help you get a signed angle.
(https://i.imgur.com/nukdo9D.png)
Bye,
Jean
-
Thanks for the reply, but I don't see how this is going to work for my purposes. I'm just trying to compare the rotation values, not dependent on position.
-
Hi,
you can't have a signed angle if you don't have a reference to define where is the positive and where is the negative.
in your case, you can manually check if the value is greater then 180, which then means it's a negative angle.
Bye,
Jean