Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: MattyWS on July 28, 2013, 04:06:08 PM
-
Hello all, I'm trying to instantiate a prefab at the location of the object with the action, but when using "Create Object" and setting the spawn point, the object created still spawns at world space 0,0,0. Is this a bug or am I doing something wrong here?
Basically what I'm doing is having a building spawn a tank every 10 seconds, so far so good apart from the spawn location. :(
-
Hi,
simply set its position after you create the object, it's fine. Save the reference of the object you just created, and the next action within the same state simply sets its position.
bye,
Jean
-
Hey Jean, I'm sorry but could you possibly elaborate on that? :) I'm still but a humble noob with PlayMaker. ^^
Thanks
MattyWS
-
hi,
actually, as I went to create a sample for you, I realised I mis readed your question...
so.. let's start again :)
Are you using the "spawn Point" property and/or the position property in your create Object action? Can you double check that the spawn point gameObject reference is not at 0,0,0?
bye,
Jean
-
Well I tried both and both resulted in the object spawning at 0,0,0 real world. The prefab of the building that spawns the units is at 0,0,0 in the actual prefab but then it's moved around in the world (placed in different locations around the map).
Thanks
MattyWS
-
hi,
that's odd indeed. I would triple check that the gameObject you use to define the spanwing point is not at 0,0,0 and else can you double check on an empty scene that you can spawn properly at a defined position? if that works on an empty scene, then it's somewhere in your logic after you create the object that it's set back to 0,0,0
pm me if you want me to look at your project if you are getting nowhere.
bye,
JEan
-
I think my problem was at some point I hit apply to the tank prefab when it was somewhere in the world other than 0,0,0 (opposite side of the map from the factory making it look like it was 0,0,0). I reset that and now it spawns a tank at the factory!
Sorry for wasting your time. :-[ Thanks very much for the help though!
-
Hi,
No time wasted, don't worry!
bye,
Jean