playMaker

Author Topic: Getting relative angle of two objects  (Read 2213 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Getting relative angle of two objects
« on: July 05, 2016, 04:34:25 PM »
I'm having a little trouble getting something to work, I need to turn an object on it's axis to match another (match it orientation, not point towards it)... trouble is I cant use standard look functions as I'm turning it with physics so I need to get an accurate reading on the amount of degrees clockwise or anticlockwise until the objects are aligned.

I have had some success simply comparing the rotation of each object, but the trouble occurs when the two objects fall either side of zero degrees.

Is there a better "get" function than just trying to calculate from world rotations? Ideally I'd like a function that just gets the relative angle of the same axis on each object, with a positive value if the other object's axis is within 180 degrees clockwise and a negative if the axis is within 180 anticlockwise.

This is so I can apply a physics torque to rotate to match the object using the shortest route.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting relative angle of two objects
« Reply #1 on: July 18, 2016, 10:01:43 AM »
Hi,

 You should try the GetDeltaAngle custom action on the Ecosystem.

It has a "signedAngle" option which could be exactly what you are looking for.

let me know if this doesn't help.

Bye,

 Jean


Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Getting relative angle of two objects
« Reply #2 on: August 03, 2016, 02:38:30 PM »
Great, I'll check that out!  Thanks

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Getting relative angle of two objects
« Reply #3 on: September 08, 2016, 01:45:54 PM »
Hi, I've tried the GetDeltaAngle action but it doesn't have the option for "signedAngle" which you mentioned.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting relative angle of two objects
« Reply #4 on: September 26, 2016, 04:57:31 AM »
Hi,

 oups sorry, you need "Get signed Angle to Target" actually.



Bye,

 Jean