playMaker

Author Topic: [SOLVED] Click and drag - Google maps style  (Read 3198 times)

kinetiknz

  • Junior Playmaker
  • **
  • Posts: 85
[SOLVED] Click and drag - Google maps style
« 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

« Last Edit: April 15, 2012, 07:05:36 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Click and drag - Google maps style
« Reply #1 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...

kinetiknz

  • Junior Playmaker
  • **
  • Posts: 85
Re: Click and drag - Google maps style
« Reply #2 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'
 :)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Click and drag - Google maps style
« Reply #3 on: April 15, 2012, 07:07:27 PM »
...so I could just make it '-1'

Good thinking! :)

kinetiknz

  • Junior Playmaker
  • **
  • Posts: 85
Re: [SOLVED] Click and drag - Google maps style
« Reply #4 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.