x


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.

more ▼

asked Jan 30 '12 at 10:00 PM

webster gravatar image

webster
90 1 2 4

Nice icon there

Jan 30 '12 at 10:18 PM DaveA

I was thinking the same thing. Cool.

Jan 30 '12 at 10:22 PM OrangeLightning

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.

Jan 31 '12 at 05:59 AM mweldon

Yes, but instead 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?)

Jan 31 '12 at 10:53 PM webster

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 instead 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.

Feb 01 '12 at 12:50 AM mweldon
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jan 31 '12 at 07:01 AM

MP2fps gravatar image

MP2fps
66 2 2 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3774
x3327
x662
x374
x231

asked: Jan 30 '12 at 10:00 PM

Seen: 763 times

Last Updated: Feb 01 '12 at 12:50 AM