ahhgghh
Blitz3D Forums/Blitz3D Beginners Area/ahhgghh
More frustration here.
using extract animseq
Player=LoadAnimMesh("models\Pearman.b3d")
ExtractAnimSeq (Player,0,18);sequence 1 ;walk
ExtractAnimSeq (Player,19,20);sequence 2;still
ExtractAnimSeq (Player,20,38);sequence 3;jump
but when I use this on the walk ( below)
While Not KeyHit(1)
If KeyDown(200)Then
MoveEntity Player,0,0,1
If AnimTime(Player) <0 Or AnimTime(Player) > 18 Then Animate Player,1,.5,1 ;( this means loopedanim, anim speed, sequence)
EndIf
EndIf
What happens it only plays the first frame of the walk cycle.
Can someone please help me on this. My animations are loaded properly, so the sequences are there.
BTW I don't really understand this line
If AnimTime(Player) <0 Or AnimTime(Player) > 18 Then
Off the top of my head try
If KeyDown(200)
MoveEntity Player,0,0,1
If Not Animating(Player) Then Animate Player,3,.5,1 ;( this means one-shotanim, anim speed, sequence)
EndIf
If AnimTime(Player) <0 Or AnimTime(Player) > 18 Then
This is checking if the current animation frame is less than zero !!!??? or greater than 18.
In your above example this will never work - the current frame will never be less than 0 and it will never be more than 18 because it loops back to 0. The walk animation goes from 0 to 18.
give the extracted anims handles like so
Player=LoadAnimMesh("models\Pearman.b3d")
walk = ExtractAnimSeq (Player,0,18);sequence 1 ;walk
still = ExtractAnimSeq (Player,19,20);sequence 2;still
run = ExtractAnimSeq (Player,20,38);sequence 3;jump
If KeyDown(200)Then
MoveEntity Player,0,0,1
If not animseq(player)=walk
Animate Player,1,.5,walk
EndIf
EndIf
That did work with my simple camera( thanks), but with the more advanced setup I borrowed for castle demo, it still won't work.( no sweat right now though)
Whats more worrying is the compexity fo trying to get the
tweens working and other glitches.For instance I would need to have a default pose, so if the character is not walking or doing anything else , he would be using this pose, then return to idle.
It looks a bit crap also if at full stride the characer suddenly returns to default pose with no tweeening.
Are there any easy to undertand examples of this anywhere, cheers
One thing that helps is specifying a transition value after the sequence. So, "Animate Player,1,[speed],still,10" should move smoothly to the idle animation (you may need to change 10 to whatever looks best).
what i do and find best is create an animation function ie
Function AnimationPlayer()
if not animseq(char\model)=char\Anim
animate char\model,char\AnimMode,char\AnimSpeed,char\Anim, char\AnimTw
endif
end function
then create seperate functions for each animation ie
Function ActionWalk()
if keydown(Walk_Key)
char\Anim = char\walk
char\AnimMode = 1
char\AnimSpeed# = .5
char\AnimTw# = 1
endif
end function
Function ActionIdle()
if keydown(Walk_Key)
char\Anim = char\idle
char\AnimMode = 1
char\AnimSpeed# = .5
char\AnimTw# = 1
endif
end function
simple example but keeps it simple in the long run
Thaks sinu I will have a look through this now.
Sinu , going back to that first expample you gave , that didn't work for some odd reason. player moves forward , but animation doesn't play
Player=LoadAnimMesh("models\Pearman.b3d")
walk = ExtractAnimSeq (Player,0,18);sequence 1 ;walk
If KeyDown(200)Then
MoveEntity Player,0,0,1
If not animseq(player)=walk
Animate Player,1,.5,walk
EndIf
EndIf
Though shamblers example did work, I was just wondering why
as they both mean the same thing ie walk is the sequence
goddamn i worked it out, must have been a fluke.
While Not KeyHit(1)
If KeyDown(200);forward
MoveEntity Player,0,0,1
If Animating(Player)=walk Then Animate Player,3,.5,1
EndIf
If KeyDown(208);back
MoveEntity Player,0,0,-1
If Animating(Player)=walk Then Animate Player,3,-.5,1
EndIf
If KeyDown(30);jump
MoveEntity Player,0,1,0
If Animating(Player)=jump Then Animate Player,3,-.5,3
EndIf
If KeyDown(203) Then TurnEntity Player,0,2,0
If KeyDown(205) Then TurnEntity Player,0,-2,0
If Not Animating (Player) Then Animate Player,3,0,2,5
By applying the 'tween'on the still sequence, it tweens between all other sequences. Looks ok. just have to work out the jump now.