playMaker

Author Topic: create next object as soon as the last object reaches a certain position  (Read 2176 times)

nepomuk

  • Playmaker Newbie
  • *
  • Posts: 32
hey, id like to get the following work.

a FSM creates a cube which moves into a certain direction based on its own fsm.
whenever it reaches a certain coordinate the next cube should be created.

my idea was to find game object und get position but since it's several objects that are created, exactly the last one would have to be found. does anyone know how i could get this work?

 regards :)

miketolsa

  • Playmaker Newbie
  • *
  • Posts: 22
  • Just love playmaker !!!
    • 4Buffs Productions
did anyone get sucess on this topic ? as how to judge the position of the previous created object as compare to the new object being created ?

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Use arraymaker. When obj spawn, put into array list. Use get/set positon : When obj is at position ( next spawn moment depending on ur own rules), get position of last obj in array and spawn.. Keep looping..

Anyway something like that...  :P

DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Hello ,

You can create a Empty gameobject called "spawn manger"
SpawnManger:
Variables :
Vector3                Position = 0,0,0
Gameobject       Last Object = null
Int                         ID =0
States :
State1 : its start state make create the prefab and store it last Object  >>add to ID +1
Finishes
State2 : Compare Vector3 to a value reach [every frame] when reach set value loop

ThePrefab
Variables :
Int MyId = 0
Int currentId
Vector3 myPosition = 0,0,0
Gameobject spawnmanger = nll

States :
State1 : find gameobject "spawn Manger">> get fsm >int>ID>store it in > MyId
Finishs
State2 : [(Your Animation)] >> get owner position >>set fsm vector3 [spawnmanger] position >> getfsm>int>Id>store it in currentid[every frame >> compare int myId and currentId if less or greater[everyframe]>gotonextstate
State3 : Done

I hope this helps  :)