x


Animate a sine wave in Unity using bone rotation?

I have imported an .fbx of a long cylinder with 5 bones (which are now objects) positioned in a straight line.

Is it possible to simulate a sine wave by updating the rotation values of the bones in that mesh through script?

more ▼

asked Dec 29 '10 at 12:53 AM

gadoo gravatar image

gadoo
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Yes. Bones are just Transforms, in Unity, so you can alter their rotations (although I think positions would be what you need for a sine wave, unless I'm misunderstanding the effect) as you like. Transform.Find will probably help you most, in acheiveing this, because unless you create the mesh procedurally in Unity, you won't know what is what, in the SkinnedMeshRenderer.bones array.

more ▼

answered Dec 29 '10 at 01:27 AM

Jessy gravatar image

Jessy
17.8k 78 101 205

when trying to assign the Transform.Find to a variable, like the example in the link, I get an error "ArgumentException: You are not allowed to call get_transform when declaring a variable. Move it to the line after without a variable declaration."

Dec 30 '10 at 12:45 AM gadoo

I was able to use a sine wave to oscillate each bone. The result I was hoping to get is as if all the bones were following and facing a spline path that was shaped like a sine wave.

Dec 30 '10 at 12:59 AM gadoo

This question is answered. Move whatever trouble you're having to another post here or on the forum; with problem code.

Dec 30 '10 at 02:52 AM Jessy
(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:

x7799
x9
x4

asked: Dec 29 '10 at 12:53 AM

Seen: 1921 times

Last Updated: Dec 29 '10 at 12:53 AM