playMaker

Author Topic: Camera Zoom In and Out...  (Read 8512 times)

Adam Z

  • Full Member
  • ***
  • Posts: 207
Camera Zoom In and Out...
« on: January 09, 2013, 10:30:52 AM »
I'm designing a character creator. I would like the user to hit a key and the camera will zoom to the head, and when you click another it will zoom back out to the body.

I have two 'Empty Game Objects'; one for the head and one for the body. Those 'Game Objects' are parented to the main character, that way if I allow the user to scale the model those will also scale as well, that way I dont have to change the position of those.  I have an 'iTween Look To' to allow the camera to focus on each game object. That works fine.

I'm having difficulty figuring out the best way to create the zoom ability.  It needs to translate in both the Y and Z, as well as change the rotation slightly. What would be the best action to accomplish those? I thought about using the 'Get Camera FOV' which would work, but I can't figure out how to animate that giving a nice ease in and out depending on what you're looking at. I was thinking about using the 'iTween Move To and From' but those have me confused.  I dont want to give it a fixed numeric for the translate and rotate, since that would cause issues if/when the character is scaled.

Thoughts?

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: Camera Zoom In and Out...
« Reply #1 on: January 09, 2013, 10:49:27 AM »
From what i'm aware Set Property will do this for you.

If you haven't used it before make sure you Lock the FSM you're working with and drag the camera component into the field.

Best of luck :)

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Camera Zoom In and Out...
« Reply #2 on: January 09, 2013, 12:20:33 PM »
From what i'm aware Set Property will do this for you.

If you haven't used it before make sure you Lock the FSM you're working with and drag the camera component into the field.

Best of luck :)

Thanks for the suggestion, but Im still having a hard time trying to figure out how that works.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Camera Zoom In and Out...
« Reply #3 on: January 09, 2013, 02:15:02 PM »
Hi,

I would recommend the following ( see working package attached)

 Have two empty gameObjects, representing the position and rotation of the camera. One when zoomed out, and one when zoomed in close to the face.

 Then use iTween to move the camera to one of these dummy, and done, you will also benefit from nice easing to have smoothed out camera movement.

 Does that make sense? to place the two dummies, you can do that easily during editing by moving the scene view exactly like you want, then select the dummy and go to the menu "GameObject/Align with view" and done :)

In your case, you will likely have to set up a constant look at for the camera and only tween the position of the camera, AND the position of the look at ( you animate the gameObject the camera is looking at, following the head or tweening back to the central body). Use smooth look at to obtain nice camera movement.

bye,

 Jean

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Camera Zoom In and Out...
« Reply #4 on: January 09, 2013, 02:19:31 PM »
Hi,

I would recommend the following ( see working package attached)

 Have two empty gameObjects, representing the position and rotation of the camera. One when zoomed out, and one when zoomed in close to the face.

 Then use iTween to move the camera to one of these dummy, and done, you will also benefit from nice easing to have smoothed out camera movement.

 Does that make sense? to place the two dummies, you can do that easily during editing by moving the scene view exactly like you want, then select the dummy and go to the menu "GameObject/Align with view" and done :)

In your case, you will likely have to set up a constant look at for the camera and only tween the position of the camera, AND the position of the look at ( you animate the gameObject the camera is looking at, following the head or tweening back to the central body). Use smooth look at to obtain nice camera movement.

bye,

 Jean

The attached package doesn't seem to have any buttons or key events to allow me to test it out. But I'll look over what you came up with and Im sure it will help. :) Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Camera Zoom In and Out...
« Reply #5 on: January 09, 2013, 02:23:41 PM »
Hi,

 no, that would be too easy :)   ;D

I created two events, both checked to show up in the inspector, so if you scroll down to view the playmaker fsm component, you will see two buttons  "HEAD VIEW" and "MAIN VIEW" in the "playmaker fsm script" component,

else you can right click on the states inside the editor to trigger them

bye,

 Jean

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Camera Zoom In and Out...
« Reply #6 on: January 09, 2013, 02:30:43 PM »
Hi,

 no, that would be too easy :)   ;D

I created two events, both checked to show up in the inspector, so if you scroll down to view the playmaker fsm component, you will see two buttons  "HEAD VIEW" and "MAIN VIEW" in the "playmaker fsm script" component,

else you can right click on the states inside the editor to trigger them

bye,

 Jean

Thanks so much!

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Camera Zoom In and Out...
« Reply #7 on: January 09, 2013, 03:56:44 PM »
Hi,

 no, that would be too easy :)   ;D

I created two events, both checked to show up in the inspector, so if you scroll down to view the playmaker fsm component, you will see two buttons  "HEAD VIEW" and "MAIN VIEW" in the "playmaker fsm script" component,

else you can right click on the states inside the editor to trigger them

bye,

 Jean

jeanfabre, after looking at your attachment I noticed that you have the 'START VIEW', 'CHEST VIEW', and 'HEAD VIEW' with states attached. How did you create those dark gray Event boxes all in the same FSM editor window? I wanted to add another, but for the life of me I cant figure it out!
« Last Edit: January 09, 2013, 03:58:39 PM by adamzeliasz »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Camera Zoom In and Out...
« Reply #8 on: January 10, 2013, 03:30:06 AM »
Hi,

In the PlayMaker editor, go to the "events" tab, create a new event, and at the bottom, you'll see the editing feature of the event you have selected, click on "Inspector" and it will show up in the component inspector ( the unity inspector)

bye,

 Jean

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Camera Zoom In and Out...
« Reply #9 on: January 10, 2013, 09:43:50 AM »
Hi,

In the PlayMaker editor, go to the "events" tab, create a new event, and at the bottom, you'll see the editing feature of the event you have selected, click on "Inspector" and it will show up in the component inspector ( the unity inspector)

bye,

 Jean

I meant in the FSM editor view, where you see the 'Chest View' dark gray box.  I want to create a 'Legs View' Event with the state 'tween to the legs view' parented to show within the editor window like in the example. It looks like you have 3 FSM's to show all at once or grouped together somehow...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Camera Zoom In and Out...
« Reply #10 on: January 10, 2013, 02:09:45 PM »
Hi,

 ok, Right click on the state and select "add global transition" then select your event, and it will show up as black on top of the state. It took me a while to figure it out as well, the vocabulary is difficult between event, transition, global transition and global event.... :)

bye,

 Jean