Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: plinm on August 22, 2017, 05:05:42 PM

Title: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: plinm on August 22, 2017, 05:05:42 PM
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.

Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: djaydino on August 22, 2017, 10:18:54 PM
Hi can you try the one in the attachment below
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: jeanfabre on August 23, 2017, 03:06:01 AM
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
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: plinm on August 23, 2017, 04:09:01 AM
Thanks,

I fixed it by making a custom action, BTW, the script you attached is the same with the original one.
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: djaydino on August 23, 2017, 11:23:13 AM
Hi,
Oops, Copy/Pasted the wrong one :)

updated the attachment in case any one else needs it
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: Arnoob on October 02, 2017, 06:14:33 PM
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 ;-)

Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: jeanfabre on October 12, 2017, 02:36:27 AM
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
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: Arnoob on October 12, 2017, 04:45:44 PM
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!
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: jeanfabre on October 17, 2017, 03:00:32 AM
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
Title: Re: GetAngleToTarget action is doing calculation in OnLateUpdate instead of OnEnter
Post by: Arnoob on October 17, 2017, 07:52:19 PM
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!