playMaker

Author Topic: Orthographic camera changing size smoothly[SOLVED]  (Read 9829 times)

fabmagic

  • Playmaker Newbie
  • *
  • Posts: 5
Orthographic camera changing size smoothly[SOLVED]
« on: June 16, 2012, 09:52:43 AM »
In my 2d game I manage to change the size to zoom out with set camera property when my player jumps high
But the problem is that it when I trigger the event the size jumps from 100 to 200
Can I put an itween animation to transition to the new size?
Thanks
« Last Edit: August 31, 2012, 03:41:09 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Orthographic camera changing size smoothly
« Reply #1 on: June 16, 2012, 10:00:52 AM »
Of course you can

Create a float variable, and use itween to tween that value from 100 to 200 or back and inject that in the camera component.

 If you have trouble with that process, tell me, and i'll make a working sample

Bye,

Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: Orthographic camera changing size smoothly
« Reply #2 on: August 20, 2012, 07:04:02 PM »
Heh, I would like to be able to do this. Ive done some itweening before and I have done orthograpic size change from set property, but I dont get how I combine this? Would appreciate some more info on how to accomplish this.

brendang

  • Junior Playmaker
  • **
  • Posts: 63
    • Out to Play Interactive
Re: Orthographic camera changing size smoothly
« Reply #3 on: August 20, 2012, 08:39:41 PM »
Agreed... A tricky business,  A sample would be awesome.  Thanks Jean!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Orthographic camera changing size smoothly
« Reply #4 on: August 29, 2012, 04:16:39 AM »
Hello,

 ok, back on this post, sorry for the delay.

 I made a working sample, but went away from tweening to actually use the "float interpolation" action which provides more flexibility.

 This is of course just a start, but basically as you have your character jumping use this fsm. I would also investigate controlling the ortho size based on the actual jumping distance so that you gain more flexibility if you have for example power jumps and such,

bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: Orthographic camera changing size smoothly
« Reply #5 on: August 29, 2012, 07:18:18 AM »
Thank you, looking at it now. Why do you Set float value (default size - last size) in "Get the Size"? I can't find where you use this. Am I missing something? Is last size really needed?

Slater

  • Full Member
  • ***
  • Posts: 123
Re: Orthographic camera changing size smoothly
« Reply #6 on: August 29, 2012, 12:34:50 PM »
Having problems getting this to work in the way I want it to. In my scene I have a subtitles fsm. In the last state in that fsm I do a Get Property and save orthographic size in a global float variable called default size. I also activate a empty gameobject called zoom camera.

In game object zoom camera I have it first wait 1 sec in first state. Then when finished it moves over to state 2, "Zoom in" state. In Zoom in state I do a Float Interpolate, Linear, From Float: globals/default size, to float: globals/target size (which is set to 8 ortho size, within the float variable), time 1, store result: globals/current size, finish event: idle.

Underneath in same state I have Set property for camera orthographic size and globals/current size.

idle event leads to idle state.

What happens is that it actually zooms to the right orthosize, but it doesnt do it smooth, it just jumps into the state.

Obviously there is something I am missing here. Any suggestions?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Orthographic camera changing size smoothly
« Reply #7 on: August 30, 2012, 04:26:27 AM »
Hi,

 last size is necessary if you jump whil jumping to prevent the zoom value to restart from the the default which would not be smooth.

 My example is of course for you to get inspired, you should apply the same technic I used in your own fsm or in a new fsm and call it from within your logic. you will need to modify your fsm's for this work and be smooth.

Send me a package of your game or just that behavior for me to have a look.

 bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: Orthographic camera changing size smoothly
« Reply #8 on: August 30, 2012, 05:32:34 PM »
Thanks Jean. Not sure how to wrap up a behavior, but I got it sorted now. I had missed that you needed to check the box on Set Property for Orthograpic size to Every Frame in order for it to work. Made sense to me as soon as I saw it and clicked it :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Orthographic camera changing size smoothly
« Reply #9 on: August 31, 2012, 03:40:56 AM »
Hi,

 ok, I am glad you got it working,

bye,

 Jean