playMaker

Author Topic: SetProperty with stored UnityEngine.Transform Variables[SOLVED]  (Read 955 times)

vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
SetProperty with stored UnityEngine.Transform Variables[SOLVED]
« on: December 06, 2015, 12: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?
« Last Edit: December 09, 2015, 06:01:29 AM by jeanfabre »

vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: SetProperty with stored UnityEngine.Transform Variables
« Reply #1 on: December 06, 2015, 02:19:24 PM »
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

Auggie

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: SetProperty with stored UnityEngine.Transform Variables
« Reply #2 on: December 06, 2015, 07:54:21 PM »
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



vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: SetProperty with stored UnityEngine.Transform Variables
« Reply #3 on: December 07, 2015, 05:27:33 AM »
Gonna try that.
« Last Edit: December 07, 2015, 05:29:08 AM by vyn_halcyon »

vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: SetProperty with stored UnityEngine.Transform Variables
« Reply #4 on: December 08, 2015, 08:47:14 AM »
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.