playMaker

Author Topic: Zooming Out with Orthographic Camera  (Read 5807 times)

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Zooming Out with Orthographic Camera
« on: July 04, 2015, 05:16:37 AM »
Hey guys,

I am using an orthographic camera and trying to zoom out when a key is pressed. I've done the Set Property change for the camera outlined in this thread:

http://hutonggames.com/playmakerforum/index.php?topic=1569.msg6806#msg6806

However, I'm looking for a smoother transition rather than a snap from one value to the other. Any ideas would be appreciated.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Zooming Out with Orthographic Camera
« Reply #1 on: July 04, 2015, 06:16:26 AM »
Hi, there are several ways you can do this.

you can animate it with animator.

or you can get DOTween and use a float variable.

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Re: Zooming Out with Orthographic Camera
« Reply #2 on: July 04, 2015, 11:54:26 AM »
can you elaborate on this? thanks

DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Zooming Out with Orthographic Camera
« Reply #3 on: July 04, 2015, 05:03:47 PM »
Hello!

Using [EaseFloat or Animate Float or curveFloat ]Actions
you can animate a float variable from a value to a value
>> then set z Position of the camera (or what ever you want to animate) check every frame [this Should be on the Same State as the Animate Action]
>> when animate action is done set it to exit this state

I hope this helped .

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Re: Zooming Out with Orthographic Camera
« Reply #4 on: July 04, 2015, 08:29:11 PM »
Thanks for your response.

The thing is that an orthographic camera doesn't take into account the translation of the camera. It stays the same no matter where the height (Y axis) of the camera is. The setting that needs to be altered is the "Size (orthographicSize)" value.

So what I did was used Get Property of this public float and stored it in a Global Variable. I then used the Ease Float action on two states and plugged in this variable to toggle between the values. It doesn't work though.
« Last Edit: July 04, 2015, 08:53:42 PM by intrikit »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Zooming Out with Orthographic Camera
« Reply #5 on: July 04, 2015, 09:10:56 PM »
Thanks for your response.

The thing is that an orthographic camera doesn't take into account the translation of the camera. It stays the same no matter where the height (Y axis) of the camera is. The setting that needs to be altered is the "Size (orthographicSize)" value.

So what I did was used Get Property of this public float and stored it in a Global Variable. I then used the Ease Float action on two states and plugged in this variable to toggle between the values. It doesn't work though.

Hi,

use Set Property and "orthographicSize" in dropdown, it should work with Interpolate Float (Ease in/out) or other float animations like DarkSoul mentioned.

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Re: Zooming Out with Orthographic Camera
« Reply #6 on: July 05, 2015, 01:31:52 AM »
Thanks for your response.

The thing is that an orthographic camera doesn't take into account the translation of the camera. It stays the same no matter where the height (Y axis) of the camera is. The setting that needs to be altered is the "Size (orthographicSize)" value.

So what I did was used Get Property of this public float and stored it in a Global Variable. I then used the Ease Float action on two states and plugged in this variable to toggle between the values. It doesn't work though.

Hi,

use Set Property and "orthographicSize" in dropdown, it should work with Interpolate Float (Ease in/out) or other float animations like DarkSoul mentioned.

Thanks, would I use these actions in the same FSM/States? This is how my states are set up.
« Last Edit: July 05, 2015, 01:35:07 AM by intrikit »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Zooming Out with Orthographic Camera
« Reply #7 on: July 05, 2015, 05:32:13 AM »
Yes similar state setup like you have,
attached an image with actions.


DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Zooming Out with Orthographic Camera
« Reply #8 on: July 05, 2015, 12:38:04 PM »
Hello,
Yhea I haven't used an Orthographic camera before , but the principal apply on animating any value [Position over time , rotation , scale ]
Anyway I played around with the orthograpic camera and I but a scene together
Here is a Sample Made with Ease Float [Press Z to Zoom in or out ]
You Can Edit the From and to Values from the inspector ,
You can also save this as a template for to apply to any  Orthographic Camera.

I hope this helps

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Re: Zooming Out with Orthographic Camera
« Reply #9 on: July 06, 2015, 02:52:43 AM »
Thanks Dark Soul and 600 for your efforts in setting up examples. I've tried both of your methods and Dark Soul's worked.

Currently, you need to press the key again to set the zoom back to normal. How would you do this by holding/releasing the key instead of pressing it again?

As it stands, my understanding of variables and how they can be used are limited and I'm trying to understand how you've come up with these solutions.

DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Zooming Out with Orthographic Camera
« Reply #10 on: July 06, 2015, 04:17:41 AM »
Hello,

I am glad it helped you  :) .

And For your question : first you need to use [get key down and get key up button action] and save the value that the camera reached so to you can animate back from there.

I hope this helps.