Playmaker Forum
PlayMaker News => General Discussion => Topic started by: Nils Anderssen on December 01, 2014, 04:35:05 AM
-
Hi,
I am trying to get a game object to follow the cursor, but without luck, so I am wondering if anyone has any good pointers on what to do. I guess the solution to this would be fairly easy, but I have not succeeded in finding it.
Any help is very appreciated.
I have tried a couple of different approaches. The first one is to use the mouse pick action (1, 2 and 3) and get the position from that. That kind of worked, but only when I moved the mouse very slowly. When i moved it somewhat quicker, it only returned 0.0.0 as the position. I used the set position action on the game object, so that returned to that position.
The second approach was to use the get mousex and y action and that worked better, but the numbers I got from it did not correspond with the size of the screen. It only moved a bit in the middle.
To clarify, I am only trying to move the object in X and Y, not Z.
All the best
N.
-
Ok, it is now solved by using the following:
Get mouse position
Screen to world point
Set position
I lacked Screen to World point, and now everything works.
It is kind of typical since I have been looking for a solution on and off for a couple of days now, and when I post the question I finally find the answer ;)
-
I used mouse pick to achieve this.
I did basically what the guy does in this video: