playMaker

Author Topic: Having trouble with a loop compare setup.  (Read 2125 times)

Sid

  • Playmaker Newbie
  • *
  • Posts: 32
Having trouble with a loop compare setup.
« on: July 09, 2014, 01:15:08 AM »
Hello.

I have a bit of a looping problem I can't seem to overcome.

In the below image, the 'Checker' is getting the position of the camera and a character and then comparing floats.

The events are changing the speed of the camera on a set of waypoints to add speed, reduce speed, or pause to keep the character in the middle of the screen (within some tolerance).

I'm using 'Next Frame Event' to avoid infinite looping and everything works great except when the camera moves too fast and gets too close to the character, it loops back and forth between 'Is Equal To' and 'Is Less Than' or 'Is Equal To' and 'Is Greater Than' each frame.  So this causes bad stuttering. 

Any ideas would be appreciated.  I looked into lerping but couldn't get it working.

Thanks!


redikann

  • Full Member
  • ***
  • Posts: 174
Re: Having trouble with a loop compare setup.
« Reply #1 on: July 09, 2014, 02:28:40 AM »
Using Floats with a Float compare can be tricky to fine tune. If your tolerance is to close  you can end up with your current situation. If to far apart you might find their are certain conditions where your logic doesn't fire anything and just hangs.
It sounds like your current setup is just the start of a more complex system. You might also want to know how fast the character and the camera are moving and then create a way to make sure the camera's speed won't encroach on the player to quickly. I'm curious how your incorporating a waypoint system and if your using the Get Distance action. If you could post a couple more screens of the guts of your actual states that would help tremendously.
« Last Edit: July 09, 2014, 02:31:05 AM by redikann »

Sid

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Having trouble with a loop compare setup.
« Reply #2 on: July 10, 2014, 04:05:57 AM »
Thanks, man.

I was trying 'Simple Waypoint System'.  It has a speed variable.

I didn't try 'Get Distance'.  I was comparing two world variables with a bool compare.  I'll have to try that.

I hope to find a way around this.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Having trouble with a loop compare setup.
« Reply #3 on: July 10, 2014, 08:58:28 AM »
Hi,

 what are you willing to accomplish here in terms of camera movement?

bye,

 Jean