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 Towards, 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?
Hi DarkSlash!
When you say move to “0,-2,0”, you set absolute values wich are relative to the scene “grid”.
In your case, you must make it relative to the object!
So There it is in C#:
transform.position = new Vector3(transform.position.x,transform.position.y - 2, transform.position.z);
Bests, Math
I have to do 3 actions, like in programming, but using Playmaker actions:
-
Create a Vector3 variable
-
Get the position an store it in the Vector3
-
Add to that vector -2 with the action Add Vector3 XYZ
-
Do a Move To the Vector3 variable that we created