playMaker

Author Topic: Zoom with mouse wheel? [SOLVED]  (Read 4264 times)

Adam Z

  • Full Member
  • ***
  • Posts: 207
Zoom with mouse wheel? [SOLVED]
« on: December 08, 2015, 05:03:56 PM »
I have three states; an Idle, a Zoom In and a Zoom Out which adds/subtracts a float to my Field of View on my camera.  I'd like to have the Mouse Wheel transition to those states depending on if I spin it forward or backward, but I'm not having any luck. What Action(s) do I need to use?

Thanks.

« Last Edit: December 08, 2015, 05:44:22 PM by Adam Z »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Zoom with mouse wheel?
« Reply #1 on: December 08, 2015, 05:21:02 PM »
I believe you want to use Get Axis with the Axis name Mouse ScrollWheel, that will give you a float.

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Zoom with mouse wheel?
« Reply #2 on: December 08, 2015, 05:44:04 PM »
I believe you want to use Get Axis with the Axis name Mouse ScrollWheel, that will give you a float.

That worked, thanks.

For those of you who would like to do the same thing:

I have a "Setup" state with a "Get Property" which gets the field of view from the camera and stores it in a "Field of View" variable. After that's stored the state enables the "Finish" event which transitions into an Zoom state.

On the Zoom state I have a "Get Axis" which stores the 'Mouse ScrollWheel' Axis Name into a 'Scroll Wheel' variable.  Change the multiplier to something lower/higher than 1. I used -50 and that worked well for me. (I used a negative number to reverse the zoom direction.) 

Then I have a "Float Add" which takes my "Field of View" and adds "Scroll Wheel" variable.

And finally I have a "Set Property" from my main camera which replaces the camera field of view with my "Field of View" variable. All of these have Every Frame checked.

Now you can zoom in/out with the scroll wheel... I hope that helps someone!

« Last Edit: December 09, 2015, 02:34:07 PM by Adam Z »

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Zoom with mouse wheel? [SOLVED]
« Reply #3 on: November 15, 2016, 06:53:06 AM »
Hi, sorry to open such an old topic but it seemed silly to start over!

I need to do exactly as outlined in the original post... but the solution no longer seems to work.  As far as I can see there is no option to get the FoV using "Get Property"... has this changed?  How do I get FoV now?

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Zoom with mouse wheel? [SOLVED]
« Reply #4 on: November 15, 2016, 10:21:14 AM »
Hi, sorry to open such an old topic but it seemed silly to start over!

I need to do exactly as outlined in the original post... but the solution no longer seems to work.  As far as I can see there is no option to get the FoV using "Get Property"... has this changed?  How do I get FoV now?

I don't have it open it front of me, but just create an FSM on the camera, select the Camera in the Hierarchy, using the Inspector Tab where the Camera is selected, drag the camera to the State tab in Playmaker. You'll get a variety of options.