Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: kaelcabral on August 08, 2013, 10:04:15 PM
-
Hey All,
I have 4 obj in my scene and I want to them exchange position randomly.
But the obj can't be at the same position from another obj.
This what I have so far:
Thanks much in advance for any information
-
Hmmm, I can think of a few ways to do it ... which is the easiest though?! Have you used Array maker before?
How I would do it with Array maker -
- Create an array and add the 4 Gameobjects (via actions)
- Create a state "Set_Position_01" that gets a random item from the array (one of the gameobjects) and then set its position to Position_01. Remove that selected gameobject from the array and then move to a second state.
- Create a state "Set_Position_02", get random item, set position, remove from array.
- Create a state "Set_Position_03", get random item, set position, remove from array.
- Create a state "Set position_04", get item at index 0, set position, remove from array.
- Move back to the first state to repeat (note the first state will re add the 4 Gameobjects)
-
Thanks for the fast reply!!
Never used array before.
I did got the script but I'm not sure if I'm doing right.
I created an empty obj than apply all theses.
Thanks so much again for the advice :o
-
Np, looking at your screen shots .... I would say it doesn't work?!
for the Array List get random you will need to set the Gameobject as a variable and then in the set position use the variable not the gameobject. Also check to see if the gameObjects are being added to the array. :)
-
You're helping me a lot!! 8)
Array is great! you can do a lot things with this.
I think I almost there, but still some bugs. not sure why...