playMaker

Author Topic: Smooth Look At 2D calls Finish Event before reaching Finish Tolerance  (Read 1460 times)

DarnVisages

  • Playmaker Newbie
  • *
  • Posts: 5
I initially posted this as a help topic here:
https://hutonggames.com/playmakerforum/index.php?topic=20927.0

After looking into it further, I believe there is a bug in the code for the "Smooth Look At 2D" action.

If a Finish Event is set, the event is called before getting below the Finish Tolerance.

These lines are in the script (starting at line 142):
Code: [Select]
//var targetDir = lookAtPos - go.transform.position;
//var angle = Vector3.Angle(targetDir, go.transform.right) - rotationOffset.Value;
var angle = Vector3.Angle(desiredRotation.eulerAngles,lastRotation.eulerAngles);

If I log the 'angle' variable to the console, it's always 0, no matter what. But when I un-commented the first two lines and commented the third line, the action began functioning correctly and giving the correct delta angle, and then correctly exiting with the Finish Event at the right time.

Please let me know if any more info is needed.

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth Look At 2D calls Finish Event before reaching Finish Tolerance
« Reply #1 on: August 12, 2019, 05:11:20 AM »
Hi,

 Please don't double post :) I replied on the other thread:

https://hutonggames.com/playmakerforum/index.php?topic=20927.0

Bye,

 Jean