Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: crossmanm on July 01, 2011, 05:15:36 PM

Title: Object Follow Mouse
Post by: crossmanm on July 01, 2011, 05:15:36 PM
Is there a way to have an object follow the location of the mouse without requiring a click?

Thanks,
Crossman
Title: Re: Object Follow Mouse
Post by: jeanfabre on July 04, 2011, 03:25:51 AM
Hi,

 Can you elaborate a bit more? by object, what do you mean? a 3d object, a 2d element of the gui? if in 3d, on what plane or surface should it stick when moving the mouse? etc etc :) then  we can propose solution:) all in all, this is absolutely possible.

 Bye,

 Jean
Title: Re: Object Follow Mouse
Post by: crossmanm on July 04, 2011, 06:18:57 AM
Thanks for the reply Jean.  The object needs to be a 3D object moving along the XZ plane.  I run into a snag when trying to convert Mouse X and Mouse Y from their normalized coordinates to world space for the object to set it's position, or maybe I'm going about it the wrong way?

Thanks,
Crossman
Title: Re: Object Follow Mouse
Post by: crossmanm on July 22, 2011, 06:00:05 PM
I'm glad it's possible, but I still haven't figured out how to do it?  I need to be able to use a cube as a 3d cursor that follows the mouse around, interacts with other game objects, and moves the camera around when it reaches the edge of the screen.
Title: Re: Object Follow Mouse
Post by: LordShaggy on July 24, 2011, 03:29:13 AM
It's late, but I've done this and will show you a few ways how later.... sigh my website just got hit again....<lord shaggy is sad>
Title: Re: Object Follow Mouse
Post by: gregmax17 on September 11, 2012, 12:45:49 AM
It's late, but I've done this and will show you a few ways how later.... sigh my website just got hit again....<lord shaggy is sad>

Is it later yet? I would like to know how to do this!

I would also like my 3d object (cube) to not only follow the mouse, but touch as well.

Anyone want to share how to do this? Thanks
Title: Re: Object Follow Mouse
Post by: Dev_Sebas on September 11, 2012, 06:25:41 AM
Hey guys did you saw the examples  of PlayMaker. There is one about that. On input MouseClickToPlace.
It´s with the mouse pick action. You just need that.
Bye
Title: Re: Object Follow Mouse
Post by: gregmax17 on September 11, 2012, 12:50:20 PM
Hey guys did you saw the examples  of PlayMaker. There is one about that. On input MouseClickToPlace.
It´s with the mouse pick action. You just need that.
Bye

Can this be updated every frame? I also would like to have my object that moves to the new point (vector3 position), to be a smooth transition. Is that possible with what you are saying?
Title: Re: Object Follow Mouse
Post by: Lane on September 11, 2012, 05:07:28 PM
I think I did this in the Angry Ships project... Look in my most recent posts for a link to download the project.

I'm pretty sure I raycast from the camera to the mouse point and save that point's data each frame as a global transform or vector3 for use by other objects based around the mouse pointer's location.
Title: Re: Object Follow Mouse
Post by: Dev_Sebas on September 12, 2012, 08:05:52 AM
Yes it can be every frame.
Title: Re: Object Follow Mouse
Post by: gregmax17 on September 13, 2012, 03:56:24 PM
I think I did this in the Angry Ships project... Look in my most recent posts for a link to download the project.

I'm pretty sure I raycast from the camera to the mouse point and save that point's data each frame as a global transform or vector3 for use by other objects based around the mouse pointer's location.

Finally was able to get to your file. I opened it up and it doesn't answer my question. You are using the raycast to store the vector3 to rotate your starship, and the arrow keys (axis) to move the starship.

I am looking for a way to have my object move towards the raycasted vector3 value.

I did just this, finally. I had to apply the Move Towards action. However, I didn't realize I "should not" set the "Finish Distance" if I wanted it to continue working every frame.

Thanks for your help everyone :)
Title: Re: Object Follow Mouse
Post by: Lane on September 13, 2012, 04:12:11 PM
I think I did this in the Angry Ships project... Look in my most recent posts for a link to download the project.

I'm pretty sure I raycast from the camera to the mouse point and save that point's data each frame as a global transform or vector3 for use by other objects based around the mouse pointer's location.

Finally was able to get to your file. I opened it up and it doesn't answer my question. You are using the raycast to store the vector3 to rotate your starship, and the arrow keys (axis) to move the starship.

I am looking for a way to have my object move towards the raycasted vector3 value.

I did just this, finally. I had to apply the Move Towards action. However, I didn't realize I "should not" set the "Finish Distance" if I wanted it to continue working every frame.

Thanks for your help everyone :)

The Missle's in there use that method.

Glad you got it figured out  ;)