playMaker

Author Topic: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter  (Read 2167 times)

plinm

  • Playmaker Newbie
  • *
  • Posts: 25
Hi there,

I am using GetAngleToTarget action to calculate some angle between two objects, and then use the angle to do some other calculation, but the GetAngleToTarget action is NOT performing the calculation in OnEnter which means by the time I use it, the value will be the 0 (default).

I don't think that's the intend behaviour of the action and it does not mention anything in the tooltip or documentation.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Hi can you try the one in the attachment below
« Last Edit: August 23, 2017, 11:23:40 AM by djaydino »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 tricky...

 the problem with this is that to get the right up to date angle, it has to be performed on LateUpdate.

 but in case where GameObject are settled in place and did not move during the frame, then computing on Enter works yes.

If GetAngleToTarget2 works for you, We'll put it on the Ecosystem I guess.

Bye,

 Jean

plinm

  • Playmaker Newbie
  • *
  • Posts: 25
Thanks,

I fixed it by making a custom action, BTW, the script you attached is the same with the original one.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Hi,
Oops, Copy/Pasted the wrong one :)

updated the attachment in case any one else needs it

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Hello Plinm.!

I am having the same problem as you. I just updated playmaker to 1.8.5 and due to the lateupdate changements, I can no longer make my GetSignedAngleToTarget work...

Could you please share your custom action, or guide us about how you fixed it?

Edit : I also had a custom action same as the get signed angle, but verticaly. Might be usefull to share ;-)

« Last Edit: October 02, 2017, 06:24:00 PM by Arnoob »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 with the new 1.8.5 you need this now to handle properly lateupdate:

      public override void OnPreprocess()
      {
         #if PLAYMAKER_1_8_5_OR_NEWER
         Fsm.HandleLateUpdate = true;
         #endif
      }


I checked and the action on the ecosystem was updated to account for this, so simply get it again from the ecosystem ( click on update if the entry is green) and it will then work.

 let me know.

 Bye,

 Jean

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Hi jean!

I already started to manually add the correct elements in my actions when I need to use lateUpdate thanks to your topic on the what's new section.

Thank you for the help!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 Let me know if you find a custom action on the Ecosystem that needs updating, I think I covered all and edited them all but I may have missed a few.

 Bye,

 Jean

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Sure thing! I'm fine for now but if in the future I download an action and it doesn't work, i'll warn you right away!