Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: aaronpaulina on March 28, 2012, 06:12:09 AM
-
Say I want to have an enemy prefab patrol back and forth, I set its position in the inspector and I want its target position to be Vector3(-4,0,0) relative to its original position. so no matter where I drag the prefab it should always patrol to the left 4 units, then return to it's position.
-
Hi,
You should use iTween for this. Specifically the move to action:
https://hutonggames.fogbugz.com/default.asp?W601 (https://hutonggames.fogbugz.com/default.asp?W601)
-- set the "vector position" to -4,0,0
-- set the "space" property to "self"
Then you should be up with this.
Bye,
Jean
-
I set the vector to -4,0,0 and checked "Self" but it still moves to World position. Is it bugged? :(
-
hi,
Give me a bit of time, I'll crack a working example for tomorow :)
Bye,
Jean
-
Okay I fixed it so far. :P
For your first state add an iTween Move to Action
Change the transform position to your object's transform
Vector position to how far you want to move and on what axis
Change space to self
Second state is the same thing but your vector position is the negative of your first.
-
Or you can also set the loop type to "ping pong" to make your object travel back to its original starting position as well.
-
I am glad you cracked it!
Justifin is right, do that with a ping pong loop type from iTween
Bye,
Jean