Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Thiaz on July 28, 2018, 04:08:11 AM

Title: [Solved] Teleport an object on Keypressed
Post by: Thiaz on July 28, 2018, 04:08:11 AM
Hello,

So i am new to playmaker and trying to learn a few things, so i decided to make a "Tower of Hanoi" game.
Just starting and i already have a problem :s

So i made a FSM to get Keys Pressed, if you press A it goes to Pillar1, E = Pillar2, R = Pillar3

I used a simple "Move Object" action with a time of 0 because i want it to be instantaneous with no animation.

When i press a key, it goes to the right position but then return to it's initial positon...
But if i set the time to 0.5 or more (meaning there is a short animation), it moves then stays at the position that i set.

Is this a bug or am i doing something wrong ? Is there a way around ? I intend to use triggers etc.. so using itween isn't the best solution because it doesn't work well with rigidbodies right ?

Images/Gif below

Thanks in advance.

PS : I'm on Unity 2017.3.1
Title: Re: Teleport an object on Keypressed
Post by: Plancksize on July 28, 2018, 07:34:36 AM
Instead of a Move action with 0 time, try a "Set Position" action.
Title: Re: Teleport an object on Keypressed
Post by: Thiaz on July 28, 2018, 10:38:35 AM
Yeah, i figured i should use "Set Position", only problem is that i can't directly specify a gameobject as a target like i did with "Move Object", i can only input Vectors.
I guess i'll have to use variable to make that dynamic.

So my problem is "solved", but i still feel like this thing is bugged. I don't know if anybody will look into it.

Thanks anyway :)
Title: Re: [Solved] Teleport an object on Keypressed
Post by: Plancksize on July 28, 2018, 11:20:20 AM
Yeah, it's a "weird" thing. I guess it's something about the "ease" functions behind the action. Maybe it's multiplying by it and the result is less than ideal.

I remember seeing a bunch of actions that have a condition in the code to turn "0" into 0.1f. Maybe those are there to avoid that same issue. Interesting catch nonetheless.
Title: Re: Teleport an object on Keypressed
Post by: Plancksize on July 28, 2018, 12:27:51 PM
<snip>
I guess i'll have to use variable to make that dynamic.
<snip>

Here, take this Action (attached) and have semi-dynamic fun :D
Title: Re: Teleport an object on Keypressed
Post by: Thiaz on July 28, 2018, 05:19:51 PM

Here, take this Action (attached) and have semi-dynamic fun :D

Haha, thanks. I found my way using Set Position but i'll give it a try :D