playMaker

Author Topic: Object move away from player  (Read 5861 times)

uberwolfe

  • Junior Playmaker
  • **
  • Posts: 59
Object move away from player
« on: April 25, 2012, 08:17:12 AM »
Hello,

I am very much a newb to Playmaker and game production in general, so please dont flame me if I'm missing something obvious.

I am trying to implement a basic move away from player (flee) routine into a gameobject, but am having trouble to get it to work.

Basically I have a friendly little bunny that bounces around randomly and will flee if the player gets too close.

There is an outer, and an inner trigger parented to the bunny.

Currently it goes something like this:

  • Object wanders around, listens for player to enter outer trigger
  • When player enters outer trigger object stops and tweens to face player, and waits for player to either exit the outer trigger, or enter the inner trigger
  • When player enters the inner trigger, object rotates 180 degrees to the player's current Y rotation and then heads in that direction for several units and then goes back to step one

This issue I am having is on the last step, I am not sure how to properly face away from the player and then head away from the player for x amount of units...

Obviously an iTween "move away from" action would be ideal, but no such thing exists?

Any advice on how to implement this would be greatly appreciated, thanks  :)
« Last Edit: April 25, 2012, 08:22:41 AM by uberwolfe »

Iwa

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Object move away from player
« Reply #1 on: April 25, 2012, 08:46:33 AM »
Hello there,

I was just wondering first if your bunny face correctly the player before he enters the inner trigger?
Mess with the best, die like the rest

uberwolfe

  • Junior Playmaker
  • **
  • Posts: 59
Re: Object move away from player
« Reply #2 on: April 25, 2012, 08:52:48 AM »
Hi Iwa,

I use an 'iTween Look Update' action on the bunny during the outer trigger phase and it seems to track the player nicely.

Iwa

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Object move away from player
« Reply #3 on: April 25, 2012, 09:19:53 AM »
Okay, so the part "rotation of 180 degrees" already works, it's the flee part wich is your problem. I've no big acknowledges (I'm maybe more newbie than you are) on playMaker but, maybe you can use the "Inverse Transform Direction" of you're bunny, to be in his own space and make him flee on adding +1 to its x or z axis (so a "Transform" Action) (it depends on where the face of your bunny is).

And if you want your bunny to do this for 3 step, then you can create a loop in your fsm :)

I'm not sure it's the best and easiest way, but that's the solution I found.

Tell me if it works well :)
Mess with the best, die like the rest

uberwolfe

  • Junior Playmaker
  • **
  • Posts: 59
Re: Object move away from player
« Reply #4 on: April 25, 2012, 09:51:48 PM »
Thanks Iwa!, I think I can't see the forest for the trees with this one...

I'll tweak it when I get home and let you know the results  :)

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Re: Object move away from player
« Reply #5 on: April 26, 2012, 02:49:22 PM »
You can use a negative number in the "move towards" action (most likely the z axis) to make it the object run away.