Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: DarkSlash on December 05, 2014, 04:54:36 PM

Title: Use transform.position in Actions
Post by: DarkSlash on December 05, 2014, 04:54:36 PM
I want to move and object to an Y position, but NOT on the X axis, just in the Y. Lets say, I want to move it to y = -2. If I use an iTween MoveTo and put the Vector3 as 0,-2,0, the object moves to x = 0  too. If I use Move Torwards, I can set the target position, but I need to put in the X textbox something like transform.position.x to leave the X position as it is. How this is done?
Title: Re: Use transform.position in Actions
Post by: Phuzz on December 07, 2014, 01:31:06 AM
You can try and set the position to "Self" and not "World", and when you put the transform locations put 0 where the X is.
Title: Re: Use transform.position in Actions
Post by: DarkSlash on December 08, 2014, 07:35:11 AM
If I do that, the object will move to -2 y from its own position. I want to every object moves to the world y = -2! But remaining in their current x!
Title: Re: Use transform.position in Actions
Post by: Lane on December 08, 2014, 08:11:15 AM
Get the position, then add the vector you want, then tween to that new vector.
Title: Re: Use transform.position in Actions
Post by: DarkSlash on December 08, 2014, 08:15:13 AM
Sorry, beginner down here! Can you be more specific? Thanks! :)
Title: Re: Use transform.position in Actions
Post by: Lane on December 08, 2014, 08:27:52 AM
iTween Move By is basically this, iirc, but otherwise...

You can use Get Position to grab the current position of the Object, say this is something like ( 20.23, 15, 19.8 ).

Now how much do you need to move it and in which direction? Make a vector that is that value, like (0, -2, 0).

Now add the two together, save it in a variable and that is your new position target, Tween to that. In this example it would be ( 20.23, 13, 19.8 )

Title: Re: Use transform.position in Actions
Post by: DarkSlash on December 08, 2014, 08:29:35 AM
Ok! Got it! The issue is that I don't need to move it -2 in the y direction... I need to move it until y = -2 in worldspace!