playMaker

Author Topic: Train tracks that line up  (Read 2025 times)

daveinpublic

  • Playmaker Newbie
  • *
  • Posts: 1
Train tracks that line up
« on: August 03, 2014, 03:06:23 PM »
Hi, I'm trying to make a system of generating prefabs in a path that a character can traverse.  I have like train tracks, I've made them into prefabs - in each prefab is a state machine that moves a creation point (a cube).  The way this whole thing is supposed to work, is I have a state machine (attached to a different cube, just meant to begin the process), which says to create a random prefab (a random train track) at the creation point.  When the prefab is created, it's state machine moves the creation point to the end of the track (each prefab is a different length, height, rotation, which is put into the state machine of each prefab).  All of this is in a loop, so that it will happen 8 times at the beginning.

The problem, is that all of the prefab train tracks are being created in the same spot.  0, 0, 0. I can see them all overlapping each other.  I can also see the creation point has moved to the correct place, somewhere off in the corner.  But, the prefabs aren't being created there. 

I think the issue is with the script that creates the tracks not talking with the script in the prefab that moves the creation point.  Because if I move the creation point within the state machine that creates the prefabs, the prefabs are created in different positions, equidistant from each other, instead of ontop of each other at 0, 0, 0. But I wanted those actions in the new prefab's state machine, cause they're different sizes and called randomly.  I've tried having the prefab move another external object that is the new prefabs spawn point, and changing the value of a global vector3 that updates the creation point after each prefab spawns, in order to get this to work.  I've tried searching, and many different attempts for days........ :( baah! Any help would be appreciated.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Train tracks that line up
« Reply #1 on: August 06, 2014, 06:38:47 AM »
Hi,

 I think you explained it properly. You need to have your different logicls to work together.

 Is it all in fsm or do you have a mix of scripts and fsm here?

bye,

 Jean