x


Animation... Unity 3D...Blender...3rd Person

Hello, I have a fully rigged, and animated 3D Model for my 3rd Person game, and, when i import the model into Unity, and play it, setup character controls and camera controls, it does the animation for 3 seconds, then stops and when i press W to move forward, it just glides and does not do the animation, Could someone please give me a script, or code, or something so i can fix that? Thanks!

Here is my Character Control...

Character Control Code

Any help would be very appreciated, thanks!

more ▼

asked May 02 '10 at 12:10 AM

Jonross gravatar image

Jonross
12 2 2 2

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

2 answers: sort voted first

You need to actually call the animation to play.

 if(isWalking) {
     animation.CrossFade("walk");
 }

 else if (moveDirection != Vector3.zero) {
     animation.CrossFade("run");
 }

 else animation.CrossFade("idle");

It also sounds like the loop mode on your animations is off. You probably have the setting on once when it should be on loop. To see the various options for looping click here. Depending on how you imported your animations do the following:

If you created a single animation in Blender and split it in the importer, find the animation in the importer and select loop as your wrap mode.

If you imported your objects using object@animation syntax, then, in the start function of your animation script add:

 animation["walk"].wrapMode = WrapMode.Loop;

This way the animation will keep playing forever instead of reaching the end of the animation and returning to the starting position.

more ▼

answered May 02 '10 at 01:17 AM

Peter G gravatar image

Peter G
15k 16 44 136

Thank you, I added the animation in, but there is one problem, the animation keeps going on after i press "W", even when i've stopped, it wont stop :(

May 02 '10 at 01:49 AM Jonross
(comments are locked)
10|3000 characters needed characters left

Looking at your script, it looks like you only have comments saying //invoke walk animation here. etc...

Unless I am missing something, you need to replace those comments with the actual code to play the animation...

Something like...

  gameobject.animation.Play ("walk");

Hope this helps,

-Larry

more ▼

answered May 02 '10 at 12:42 AM

Larry Dietz gravatar image

Larry Dietz
472 8 13 22

(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:

x3802
x3741
x454
x86
x37

asked: May 02 '10 at 12:10 AM

Seen: 2631 times

Last Updated: May 02 '10 at 12:10 AM