Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: TomsTales on November 04, 2020, 06:48:06 AM

Title: Mouse Movement 2D
Post by: TomsTales on November 04, 2020, 06:48:06 AM
Hi Guys,

new to Playmaker and Unity in General, so...

I am getting crazy about this. I would like to have a simple "Click ob Object, Click somewhere else in the Scene, Object moves to this Point".

I found several things for 3D but not for 2D and I just can't make it work. It can be as simple as possible...I found Move Towards and stuff but this just moves the object with no control...

Argh!

Cheers
Title: Re: Mouse Movement 2D
Post by: TomsTales on November 04, 2020, 07:00:04 AM
To add, the idea is to "respawn" if you will the object where I do the second click. or drag it. I don't care anymore at this point lol
Title: Re: Mouse Movement 2D
Post by: djaydino on November 04, 2020, 07:56:08 AM
Hi.
Which Part you can't get to work.

can you select a object?

can you select a position to go to?

Title: Re: Mouse Movement 2D
Post by: TomsTales on November 04, 2020, 08:03:30 AM
Hey mate,

well  basicallyI have been using this tutorial by Dumb Game Dev:


Everything runs as intended until well, it comes to the actual movement I guess. I think selecting the object will work, but moving it does not. There is a comment in the video saying

For 2D movement use:
Mouse pick 2d
and
Move towards


but I can't implement this. Also I take the easiest way possible as for now, I don't really care if the objects really "moves" or just" teleports to the new position....

Cheers
Title: Re: Mouse Movement 2D
Post by: djaydino on November 04, 2020, 03:57:31 PM
Hi.
I think to position you need to do something like :

on mouse clicked, get mouse x and y, then use 'Screen to world point' to get to 'word position' that you clicked.

then move to that position.
Title: Re: Mouse Movement 2D
Post by: TomsTales on November 05, 2020, 08:15:45 AM
Thanks man, I will try later!
Title: Re: Mouse Movement 2D
Post by: TomsTales on November 05, 2020, 02:54:42 PM
Hey, maybe you can give me some more detail as I am stuck...I tried what you said but it stops at get x and why and does not move to screen to world...
Title: Re: Mouse Movement 2D
Post by: djaydino on November 05, 2020, 05:14:55 PM
Hi.
On the playmaker window, if you select the state tab.
On the bottom there will be a checkbox called 'Debug' turn that on so you can see on you action what values it gives while playing (and while not playing as well).

I can see that you have a object on the move toward. you need to leave that empty. (read the description of the move toward action :) )

if its the object that you want to move then click on use owner and select specify game Object, then you get another slot to place a game object.
Place the object there, that you want to move.