playMaker

Author Topic: Smooth Look At 2D bug?  (Read 1245 times)

DarnVisages

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Smooth Look At 2D bug?
« on: August 07, 2019, 11:30:52 PM »
Hi,

I'm new to Playmaker, so I hope this is just user error.  When I set up a state with the "Smooth Look At 2D" action, my GameObject starts to toward the target object briefly, but stops after maybe a frame, before reaching the correct rotation.

I have the Finish Tolerance set at 1 degree, and have assigned a Finish Event, but it is launching the finish event way before it ever reaches the correct look vector.

If I clear the Finish Event to none, the state will complete the full rotation until it is looking the correct direction, but never exits (just continues to keep looking at the target object, while it moves or not).  But then I have no way to make it exit.

Please let me know if I'm missing something or misunderstanding how to use the Finish Tolerance/Event.

Thanks!

EDIT:  Here's a video where I'm demonstrating the issue. I'm trying to get it to do the smooth-look back and forth between two objects:
https://drive.google.com/open?id=1w2b6Huk-qnWSxc-Rzcnjwblkk4GFtuWC
« Last Edit: August 08, 2019, 11:29:59 AM by DarnVisages »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15467
  • Official Playmaker Support
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #1 on: August 08, 2019, 02:14:04 AM »
Hi,

 maybe the target is already aligned below the finish tolerance before you start the action and so when it begins it's already in and fires the finish event?

make sure you set a custom event for the finish event, do not use FINISH, right?

Bye.

 Jean

DarnVisages

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #2 on: August 08, 2019, 02:31:35 AM »
Hi Jean,

Thank you for the response!

No, I don’t believe it’s starting when already below the finish tolerance (which is set to 1). It’s stopping when pointing visibly far off. Regardless of the starting position it rotates only a couple degrees then stops. It will only keep turning and stop at the correct alignment if I set the finish event to none.

Yes, the finish event I’m using is custom, simply called “Stop Tracking”

Thanks

EDIT: Please see my original post, I made a video with a use-case demonstrating the issue.
« Last Edit: August 08, 2019, 11:31:02 AM by DarnVisages »

DarnVisages

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #3 on: August 08, 2019, 11:58:16 AM »
Hi Again,

So I'm pretty sure this is a bug after all.  In the script for Smooth Look At 2D, there are these lines (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);

I tried un-commenting the first 2 lines, and commenting out the third line, and the state machine began working as expected. 

I believe the third line is always returning 0, making it mistakenly determine the object is always under the finish tolerance, and thus exit after only a single frame every time.

I'll report this as a bug, in case the first two lines still have issues and it should be looked at closer.

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15467
  • Official Playmaker Support
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #4 on: August 12, 2019, 05:00:40 AM »
Hi,

 yes, indeed I can repro this. I am not sure why in the first place this was replaced by this new way of computing.. Maybe this was to paliate another issue, but I am not sure which one, I'll investigate.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15467
  • Official Playmaker Support
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #5 on: August 13, 2019, 03:07:55 AM »
Hi,

 so, it's actually fixed in the up and coming 1.9.1 version of PlayMaker. Are you part of the beta ?

Bye,

 Jean

DarnVisages

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #6 on: August 16, 2019, 03:41:29 PM »
Hi,

Awesome. Nope, I’m not part of the beta.

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15467
  • Official Playmaker Support
    • View Profile
Re: Smooth Look At 2D bug?
« Reply #7 on: August 19, 2019, 02:14:37 AM »
Hi,

 so if you want, you can apply, but here since you have a fix already, it's not really necessary, it's up to you.

 Bye,

 Jean