playMaker

Author Topic: Smooth follow for objects  (Read 4634 times)

switch

  • Playmaker Newbie
  • *
  • Posts: 2
Smooth follow for objects
« on: December 14, 2013, 05:50:26 PM »

Hi

I'm having fun learning Playmaker and gradually polishing my game but have a problem I can't solve.

I have some enemies floating in 2D space, they move randomly around the screen until an event occurs and then they chase a new target.

I set this up in two ways, the first I created a bunch of blank game objects, assigned numbers to them and then create a random number to decide which one the enemy moves towards. Another method was to create random floats, converted to vect3 for the enemy to move towards. This works except when they target a new position the change in direction is instant.

I'd like to have some momentum or smoothing when the enemies change direction but I can't work it out. I know I can do something similar in iTween but I want to be able to interrupt the movement and never allow my enemies to stand still, they should always have momentum.

I nearly solved it by using the 'Smooth Follow Action' but this only works in one axis.

Below is an image of the type of motion I currently have and what I am looking for, any help much appreciated.

Thanks
Simon


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth follow for objects
« Reply #1 on: December 16, 2013, 07:15:19 AM »
Hi,

 smooth follow action works in 3d, I am not sure why you are saying it work son only one axis?

doing this kind of follow could be achieved with a proper physics "tracker" system, so that you apply forces to have the seeker follow its target, then you will get this smoothed out effect, but that's quite a challenge to implement. Doing this mathematically would also be a challenge as you have to add some momentum and overshooting effect to it. Quite tricky if you ask me.


Bye,

 Jean

switch

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Smooth follow for objects
« Reply #2 on: December 18, 2013, 02:40:35 AM »
Thanks for the reply Jean

Yes, with the "Smooth Follow Action" it did not work, but I did get it to work using the Unity script "Smooth Follow 2D" it does work. I was just hoping to be able to control it directly from within Playmaker.

I have attached my test scene to see if I am doing anything wrong.

Below is what I see with the playmaker Smooth Follow Action - maybe because I am trying to use it in a 2D situation it's not working as intended.

Thank you
Simon


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth follow for objects
« Reply #3 on: December 19, 2013, 02:53:06 AM »
Hi,

 yes, the 2d needs specific actions for this, here it assumes a 3d objects with the y axis up, and in 2d, it's now the z axis.

 Which, just to make a point..., reminds me that I was right when I complained very early on that their axis distribution was definitly not ideal, it should have always been right handed AND z axis up, this way, EVERYTHING would have worked just fine moving into a 2d scene.

I think this is very bad to have left handed and y up, 99% of other systems use right handed z up or at least give an optio to choose... it may be for optimization, but not really sure.

Bye,

 Jean