Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: kinetiknz on April 14, 2012, 10:22:15 PM

Title: [SOLVED] Click and drag - Google maps style
Post by: kinetiknz on April 14, 2012, 10:22:15 PM
Hi there, I am trying to setup a simple click, hold and drag script that moves a camera around. similar in the way that Google maps works.

I'm having some trouble figuring out the action flow to proceed though. I have mouse click action, and set Position, eventually I will have to invert the values somehow as the camera should move in the opposite direction to the mouse.

As I understand it, I have to do this:

left mouse click down
store the position in a vector
record the movement of the mouse while being held down - how?
compare the current moving vector to the stored one saving the output
invert the output
apply the transform to the camera


Any help very appreciated. Thanks

Title: Re: Click and drag - Google maps style
Post by: Alex Chouls on April 14, 2012, 11:34:15 PM
You can use Get Axis Vector to get the mouse movement. Use "Mouse X" and "Mouse Y" as the axis names.

Then use the stored vector with Translate to move the camera.

If I remember correctly, you might be able to do the invert in the Input Manager setup for the axis...
Title: Re: Click and drag - Google maps style
Post by: kinetiknz on April 15, 2012, 06:47:30 PM
Awesome, done thanks Alex. the get axis vector has the multiplier attr aswell, so I could just make it '-1'
 :)
Title: Re: Click and drag - Google maps style
Post by: Alex Chouls on April 15, 2012, 07:07:27 PM
...so I could just make it '-1'

Good thinking! :)
Title: Re: [SOLVED] Click and drag - Google maps style
Post by: kinetiknz on April 15, 2012, 07:09:09 PM
Hey Alex, while I am here, do you know of any video tutorials that explain practices for Playmaker? It's one grey area for me.