Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 BillyK · Dec 13, 2010 at 11:29 PM · animationcameracamera-movement

Camera on rails: Inaccurate Animations

Hi,

In my application, I am using animations to move a camera around a scene back and forth between specific locations (essentially a camera on rails). The animations, however, do not appear to accurately move to the same precise locations each time (i.e. it doesn't always reach the exact end-point, thereby skewing the resulting view, etc.).

Does anyone happen to have any ideas why my animations may not be moving in a precise fashion? Is that expected behavior (meaning I really shouldn't be doing it this way)?

NOTE: The only thing managing my camera motion is the animations themselves and I am not blending them. They work individually and do not overlap.

Bill

NOTE: If further information about my setup would help to get to the bottom of this, please let me know and I'll fill in more details.

Comment
Add comment
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

2 Replies

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

Answer by Paulius-Liekis · Dec 14, 2010 at 09:28 AM

There is a bug in Unity which causes animation not to be sampled at last frame. As a workaround set your animation wrap mode to ClampForever or control animation time yourself.

Comment
Add comment · 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
0

Answer by BillyK · Dec 14, 2010 at 10:06 PM

Thanks for the info. It was very helpful...

The problem with the "ClampForever" route is due to the fact that I'm leveraging the animations in reverse in order to return to the original point in the scene. When an animation is set to "ClampForever", it appears to elongate the length of the animation (essentially playing the last frame of the animation forever). When I reverse the animation, it then appears to pause for a while prior to triggering the move in reverse. The length of the pause is the length of time that the animation was running before the reverse was triggered (i.e. the enlogated portion of the animation). This same issue appears to be the case when the animation is run in reverse, regardless of the wrap mode. That was something I worked around a while back, actually.

Based upon your info, though, I did come up with a route that works. My original fix for the never-ending reverse issue (mentioned above) involved the use of animation events at the beginning and end of the animation. When those are triggered, the code will cause the animations to stop (when running in reverse). In order to fix the issue involved in this thread, I augmented the code in those events to force the animation to the appropriate time and force a sample at that point. The code looks like this:

public void AnimationStartReached(AnimationEvent animationEvent) { string animationName = animationEvent.animationState.name;

 if (_isPlayingReverse)
 {   
     AnimationState animationState = animationEvent.animationState;
     animationState.time = 0f;
     animation.Sample();

     animation.Stop(animationName);
 }

}

This forces the animation to hit its endpoint, regardless of the variable frame rate. From what I can tell, this appears to resolve my issue, forcing the animations to hit their precise end points.

Anyone see any issue with this approach?

Thanks again.

Bill

Comment
Add comment · Show 1 · 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 Paulius-Liekis · Dec 15, 2010 at 10:10 AM 0
Share

Yes, forcing animation sample at desired point is probably the approach that I would take too until the actual issue is fixed on Unity side.

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

No one has followed this question yet.

Related Questions

Cinema 4D camera-movement doesn't work in Unity 0 Answers

Camera movement simultaniously with text output in a dialgogue box 0 Answers

Having Trouble animating camera at start of game 0 Answers

Import animated camera from 3ds max 1 Answer

Camera animation issue 0 Answers


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