Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by lordsme · Oct 18, 2012 at 05:36 PM · animationanimationcurvefov

Field of view scripted animation curve

Hello everyone, I'm trying to animate the field of view of a camera in a C# script, using Animation classes. Here's the code that does not work, no animation happens:

 AnimationCurve curve_fov = AnimationCurve.EaseInOut(0, camera.fieldOfView , duration, 80);
         clip.SetCurve("", typeof(Camera), "fov", curve_fov);
 animation.AddClip(clip, "FOVAnim")
 animation.Play("FOVAnim");

I had a lot of troubles finding the Field Of View property name (I found "fieldOfView", "fov", etc), I ended up using a script found in the web that shows all property names... why there's no common property dictionary in the documentation???

By the way this is not working...

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lordsme · Oct 23, 2012 at 02:43 PM 0
Share

Please help!

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Xroft666 · Oct 23, 2012 at 04:19 PM

Take it :)

 using UnityEngine;
 
 public class CameraAnimation : MonoBehaviour {
     
     public AnimationClip clip;
 
     void Start () {
         AnimationCurve curve_fov = AnimationCurve.EaseInOut(0, camera.fieldOfView , 10, 200);
                clip.SetCurve("", typeof(Camera), "field of view", curve_fov);
         animation.AddClip(clip, "FOVAnim");
         animation.Play("FOVAnim");
     }
 }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lordsme · Oct 23, 2012 at 05:02 PM 0
Share

Thank you very much, it works... How did you find the right property name ("field of view") ????

avatar image Xroft666 · Oct 23, 2012 at 05:16 PM 0
Share

I used some tricks you can find here:

http://answers.unity3d.com/questions/336397/override-transform-inspector-using-serializedobjec.html

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Player is running just few seconds 0 Answers

weird animation problem in multiplayer 1 Answer

Playing animations problem 1 Answer

How to run an animation mouse click. 2 Answers

I try'd so hard, but my animation script doesnt work..? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges