playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
Comparing the angle of two objects
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Comparing the angle of two objects (Read 1119 times)
RobotGoggles
Playmaker Newbie
Posts: 35
Comparing the angle of two objects
«
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?
Logged
When life hands you insomnia, make video games.
jeanfabre
Administrator
Hero Member
Posts: 15500
Official Playmaker Support
Re: Comparing the angle of two objects
«
Reply #1 on:
February 24, 2020, 03:46:24 AM »
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.
Bye,
Jean
Logged
RobotGoggles
Playmaker Newbie
Posts: 35
Re: Comparing the angle of two objects
«
Reply #2 on:
February 25, 2020, 01:31:51 AM »
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.
Logged
When life hands you insomnia, make video games.
jeanfabre
Administrator
Hero Member
Posts: 15500
Official Playmaker Support
Re: Comparing the angle of two objects
«
Reply #3 on:
February 25, 2020, 02:00:09 AM »
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
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
Comparing the angle of two objects