Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: koop4 on March 10, 2014, 10:57:56 AM

Title: How do I use the Get Posotion Variable? [Solved]
Post by: koop4 on March 10, 2014, 10:57:56 AM
Hi everyone!
In my project i have some object which i would use to generate objects.
The "Get Position" Reference says:
"Gets the position of a game object and stores each axis in a float variable"
I would like to know how can i use this variable in my next action "Create Object", because it generate the prefabs in the 0,0,0 world position.

Thanks in Advance.
Rob
Title: Re: How do I use the Get Posotion Variable?
Post by: Lane on March 10, 2014, 11:10:41 AM
Get position can grab and store the world position of a Game Object in the scene, so essentially you use Get Position to find out where something is located at in the world with coordinates on the X, Y and Z planes and then keep those coordinates either separately in 3 unique floats or all together in a vector3 variable. Vector3's can be thought of like basically just 3 floats grouped together.

Once you have a position in the world and have saved some coordinates you can use the Create Object action to bring something into the scene. It needs to know where to put it, so you just tell it to use those coordinates you saved. You can also specify a game object as the target spawn point, which is usually easier because you can just place and empty game object in the scene and target it for your spawns.

Make sense?

Title: Re: How do I use the Get Posotion Variable?
Post by: koop4 on March 10, 2014, 11:17:28 AM
Yes, I was hoping it was possible to obtain the location and use it without storing in a variable.
Thanks sir!