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 webster · Jan 30, 2012 at 10:00 PM · animationperformanceruntimedynamic

Which is better: script or animation (which needs to change with scripting)?

My project has some objects that I load at runtime. Some of them need to be animated. A simple bounce for example. And the speed and amplitude of that bounce needs to be alterable at runtime too. There may be many such objects.

Is it better to conditionally attach a 'movement' script to such objects, and script that movement (using standard math/trig), or use the Animation Editor to create the movement, then (somehow) access those curves and alter them as needed?

Better is defined in terms of performance (runtime speed and memory footprint) rather than simplicity of implementation.

Comment
Add comment · Show 5
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 DaveA · Jan 30, 2012 at 10:18 PM 1
Share

Nice icon there

avatar image FLASHDENMARK · Jan 30, 2012 at 10:22 PM 1
Share

I was thinking the same thing. Cool.

avatar image mweldon · Jan 31, 2012 at 05:59 AM 0
Share

Wouldn't modifying the animation curves require you to do the physics calculation in a script anyway? I'd go with the movement script, or use rigid body.

avatar image webster · Jan 31, 2012 at 10:53 PM 0
Share

Yes, but ins$$anonymous$$d of doing some trig on every frame, it would would be a very occasional adjustment to speed or amplitude (if I can scale either of those on an animation via script?)

avatar image mweldon · Feb 01, 2012 at 12:50 AM 0
Share

Well it would just be calculating gravity and doing collision detection, right? There no trig involved, and it should be pretty fast. I'm not sure pre-calculating the path and doing a table look-up would be noticeably faster, and you would have to recalc the path any time the object changed direction. I would try it the simple way first and worry about optimization if it turns out to be too slow.

And by "simple way", I mean use rigid bodies and colliders. Let the internal physics engine do what it was designed for ins$$anonymous$$d of writing your own. Though without knowing exactly what you are trying to do, it is hard to be sure that this is the right choice.

1 Reply

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

Answer by MP2fps · Jan 31, 2012 at 07:01 AM

in personal experience using Blender to create animations, i would use scripts, unless your good at creating animations. Also it depends on what your animating, Ex: a walk animation vs a cube bouncing up and down. it would probably be best to use both for certain situations.

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

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

8 People are following this question.

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

Related Questions

Changing AnimationClips at runtime 0 Answers

Bake Animation during Run-time in Unity 2 Answers

How to assign "data" in script at runtime 0 Answers

Need help with a performance issue on my animation script 1 Answer

Adding animation clips via script 2 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