Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: HeathClose on January 11, 2017, 04:45:47 PM
-
I have an fsm spawning a game object at random points...
it stores that location.. for example... -1.4, 133, 0
this is a 2d game, so i want that object to now tween along the x axis... for example...
ping pong from -1.4, 133, 0 (where it spawned) and 1.4, 133, 0
is there a way to use an action to get the location to tween to as a negative of the x coordinate?
I tried using this...
(https://www.dropbox.com/s/n8fud72028t34jh/Screenshot%202017-01-11%2015.37.40.png?dl=1)
but that just breaks the syntax and makes it all 0,0,0... (pic not of runtime... i know there isn't a string to change it to in the pic but I get a variable at runtime)
How could I do this?
-
If I'm not mistaken, you can just multiply your variable with vector multiply and that should get it.
-
If I'm not mistaken, you can just multiply your variable with vector multiply and that should get it.
Awesome... i didn't know that was a thing... thank you...
when I multiply the vector 3 by -1... it multiplies them all by -1, so instead of tweening along the x axis and it's negative... it also tweens to the y axis negative... and I only want to multiply the x by -1...
-
Which itween action are you using for your movement?
-
Which itween action are you using for your movement?
itween move to set to ping pong
-
Take a look at Set Vector3 XYZ. You can 0 out your other two values and leave your X axis unchanged.
-
Take a look at Set Vector3 XYZ. You can 0 out your other two values and leave your X axis unchanged.
thanks for that idea!
I need to retain my y axis, that one won't work for me
-
It's configurable. You can alter any of the vectors and keep whatever you want, unless I'm misunderstanding you.
-
It's configurable. You can alter any of the vectors and keep whatever you want, unless I'm misunderstanding you.
OK! thank you ... so your help lead me to the solution indeed...
first.. get vector3 xyz and store those values
second... float multiply (the x by -1)
third... set vector3 xyz
Bob's your uncle...
thank you!
-
Happy to help!