Manipulating .B3D character animations

Blitz3D Forums/Blitz3D Beginners Area/Manipulating .B3D character animations

Avrigus(Posted 2008) [#1]
Hey guys,

I've been trying to get .B3D character animations to work properly for a few days and i'm having a lot of trouble.

Basically i'm using a Mario character (taken fron Sinu's great 3D Mario demo from a few years ago) and I simply want to use the idle state for when he's idle, the walk state for when the player moves the character etc.

The problem i'm having is when I move the character the animations stops. Here's an example of the code I wrote:

If CharX > 0.02 Then Animate Dude, 1, 0.46, 2, 12

If Not Animating (Dude) Then
    Animate Dude, 1, 0.46, 1, 12
End If


I'm also trying to control the animation speed by feeding the characters X speed into the animation speed variable but that just seems to freeze the animation entirely.

If anyone has tips or can spot what i'm doing wrong it would be very much appreciated :-)


Dreamora(Posted 2008) [#2]
1. Use Animation States. This means that you set a state walking = true or movementState = walking on charx > 0.02 for example and then
if movementState = walking and <if animation xy is not playing> animate ....

yours will restart the animation whenever charx > 0.02 which obviously means that you will never leave the initial frame.


Avrigus(Posted 2008) [#3]
ok i'm completely stumped now, everything I do seems to get stuck on the first frame of the animation. I've tried so many different options and all it's done is confuse me ;-)

Anyway here's my complete code, please excuse the mess:



Here's a link to the character files used:
Animate_Character.zip

Any help here would be most appreciated! :-)


Hujiklo(Posted 2008) [#4]
global Char_anim1
global Char_anim2

Char_anim1 = LoadAnimSeq Dude, "Character\idle_empty.b3d"

Char_anim2 = LoadAnimSeq Dude, "Character\walk_empty.b3d"


Animate Dude, Char_anim1 , 0.46, 1, 8


A quick look tells me tweaking these lines should work better.


Avrigus(Posted 2008) [#5]
Umm that doesn't work at all, your syntax is a little.... wrong ;-)

I have looked at many examples and searched the forums regarding character animation and i'm still not quite getting the logic behind animating .B3D characters.

I mean I don't get why the animate command cannot be used properly by itself in the main program loop. Everytime I try to use it by itself my animation freezes...


Hujiklo(Posted 2008) [#6]
Animate Dude, 1, 0.46, Char_anim1 , 8


Either way - you're telling it animate an animsequence called ' 1'...you have to assign the sequence to a variable otherwise it means nothing...especially in a fully coded game.


Char_anim1 = LoadAnimSeq Dude, "Character\idle_empty.b3d"

..Also why are your anims all separate b3ds? How did you do your animations? It's tidier to do one long animated stream and load in one fully animated B3D file and then use 'extractanimseq' to chop out the anims and assign them to (global) variables.

..and another thing if 'char_idle= 1' then you have to set it to another value when you start the animation. you just have a loop going on here and the animation is constantly restarting at frame 1.

If Char_Idle = 1
Animate Dude, 1, 0.46, Char_anim1 , 8
Char_Idle = 0
End If