Help Animating Model

Blitz3D Forums/Blitz3D Programming/Help Animating Model

YellBellzDotCom(Posted 2007) [#1]
My god man! I have looked at this for 2 days and cant figure out why this doesnt work. If I press 1,2,3,4 it should change the animation to whats noted.

Graphics3D 1024,768, 32,1
SetBuffer BackBuffer()

Global Play1 = LoadAnimMesh("Man_idle.b3d")
PositionEntity Play1,0,0,-150
RotateEntity Play1,0,180,0
LoadAnimSeq(Play1,"Man_walk_Forward3.b3d.")
LoadAnimSeq(Play1,"Man_Chop.b3d.")
LoadAnimSeq(Play1,"Man_Pick.b3d.")
LoadAnimSeq(Play1,"Man_Fight_Fists.b3d.")

Global Lite = CreateLight()

Global Cam = CreateCamera()
PositionEntity Cam,0,20,-100
PointEntity Cam,Play1


CameraClsColor Cam,255,255,0

While Not KeyHit(1)
	If KeyHit(2) Then 
		Animate Play1,1,.5,0
	EndIf
	If KeyHit(3) Then 
		Animate Play1,1,.5,1
	EndIf
	If KeyHit(4) Then 
		Animate Play1,1,.5,2
	EndIf
	If KeyHit(5) Then 
		Animate Play1,1,.5,3
	EndIf
	If KeyHit(6) Then 
		Animate Play1,1,.5,3
	EndIf
	
	UpdateWorld()
	RenderWorld()
	
	Color 0,0,0
	Text 10,10,"Animating: "+Animating(Play1)
	Text 10,30, "Anim Seq: "+AnimSeq(Play1)
	
	Flip
	
Wend

ClearWorld()
End()
	


can anyone take a look at this and see if they find anything that would lead to the animations not changing when I press 1,2,3,4 keys?

Thanks for any help.


jfk EO-11110(Posted 2007) [#2]
Try this:

p1=LoadAnimSeq(Play1,"Man_walk_Forward3.b3d.")
print p1
p2=LoadAnimSeq(Play1,"Man_Chop.b3d.")
print p2
p3=LoadAnimSeq(Play1,"Man_Pick.b3d.")
print p3
p4=LoadAnimSeq(Play1,"Man_Fight_Fists.b3d.")
print p4
waitkey()

So they should return the sequence number. BTW keyhit 6 plays the same sequence as keyhit 5 (sequence 3)?

And make sure all the animations work if you load them with LoadAnimMesh.


cash(Posted 2007) [#3]
this should work

if keyhit(2)=1 then
if animseq(player)<>1 then animate player,1,1,1
endif

and so on


YellBellzDotCom(Posted 2007) [#4]
Sorry for the late reply there, just home from work a bit a ago.

I tried the first suggestion and it prints all 0's to the screen. which doesnt make any sense.

I have loaded each file with loadanimmesh(file) and they do animate.

I tried the last suggestion and it still doesnt work.

I am trying to use this...
	If KeyHit(2) = 1 Then
		Animate Play1,0
		Animate Play1,1,1,1
		KeyNum = 0
	EndIf
	
	If KeyHit(3) = 1 Then
		Animate Play1,0
		Animate Play1,1,1,0
		KeyNum = 1
	EndIf


just to switch from 1 animation to the other, when I press the 2 key it will play my idle animation, but when I press the 1 key, the idle animation stops but the walk animation wont play.

I cant believe this. I have no idea what is going wrong here. Thanks for the attempt there.


SLotman(Posted 2007) [#5]
If it's printing a lot of 0's than this means it didnt load anything! That's why it isnt working :)

Also, I do animations slightly different... I export only one file, with all animations inside it, load it and use ExtractAnimSeq to get different anims. But I dont know if my method is better or worse than yours :P


YellBellzDotCom(Posted 2007) [#6]
God I'm an idiot! Look closely at my files Im trying to animate!

LoadAnimSeq(Play1,"Man_walk_Forward3.b3d.")
LoadAnimSeq(Play1,"Man_Chop.b3d.")
LoadAnimSeq(Play1,"Man_Pick.b3d.")
LoadAnimSeq(Play1,"Man_Fight_Fists.b3d.")


see the periods at the end of the file names? They weren't loading because of that. When I copied the files to try each one out individually, I didnt copy the period to the loadanimmesh(file) command, so the animation worked. This act of tardness cost me 2 days, lol.

Thanks again for the help there cash, I do appreciate it.


jfk EO-11110(Posted 2007) [#7]
Hey wow I didn't see the periods. That's a mean, disguised typo.