Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: vyn_halcyon on December 06, 2015, 02:30:14 PM
-
TLDR; Which Properties can be set with UnityEngine.Transform variables?
I am creating a scene where a Car is displayed in 3D. The car is parent to many 3D components each interacteable (mouse pick, follow mouse).
Now after picking apart the car, I'd like to right click a component and have it "reset" back to it's original spot, when the car first loaded.
I am currently storing the local transforms of the car components into a UnityEngine.Transform Variable (via Get Transform Action). The variable I call "StartingPosition".
Now I want to use "Set Property" to set the transform of a GameObject with the transform information stored within the "StartingPosition" variable so that the object returns to it's... well: Starting Position.
Since there is no "Set Transform" action I am trying to figure this out using "SetProperty"
Any idea which property uses which variable for getting and setting local transforms?
-
Dear myself,
Try working this into a script and use this in conjunction with Playmaker:
vector3 originalPosition;
function Awake()
{
originalPosition = transform.position;
}
function GoBackToOriginalPosition()
{
transform.position = originalPosition;
}
Yourself Truly,
Vyn Halcyon
-
I've been using Get/Set position/rotation actions to set the position/rotations. That might be simpler. There's a drop down in the those actions to switch between local/world positions
Auggie
-
Gonna try that.
-
Awesome. It worked like a charm.
The problem was I didn't set variables for the X, Y and Z...
And thus I face-palmed so hard, my face collapsed in on itself creating a black hole.
I have a feeling I am going to do that quite often.