Error animating

BlitzMax Forums/MiniB3D Module/Error animating

YellBellzDotCom(Posted 2012) [#1]
I have a model that I use to create clothing. The actual model loads in miniB3d fine and animates fine but when I load a shirt that I created from the base model I get an unhandled exception, attempt to index array element beyond array length.

The thing that is really confusing me is that this shirt model worked fine in B3d and the base model works fine using the same exact minib3d code in bmax. Both models have the same biped and bones, since the shirt model was created from the base model.

The shirt model has an animation length of 5, but the program crashes when AnimTime reaches .896667, which absolutely baffles me.

heres some of the code I am using to animate the model...
Import sidesign.minib3d

SetGraphicsDriver GLMax2DDriver() , GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER

Graphics3D 1024,768,16,0

Global shirt001:TMesh

shirt001 = LoadAnimMesh("Media/Models/Items/Shirt/Shirt LongSleeve Red.b3d") 'idleanimation 0
shirt001.LoadAnimSeq("Media/Models/Items/Shirt/Shirt LongSleeve Red Forward.b3d") 'WalkAnimation 4 Frames

Cam = CreateCamera()
PositionEntity(Cam,0,500,-400)
RotateEntity Cam,60,0,0

Global anState:Int = 0
Global anim_Time:Float = 0.0

While Not KeyHit(KEY_ESCAPE)
	
	If KeyDown(KEY_W) And KeyDown(KEY_A) 'wa
		RotateEntity shirt001,0,-135,0
		anState = 1
	ElseIf KeyDown(KEY_W) And KeyDown(KEY_D) 'wd
		RotateEntity shirt001,0,135,0
		anState = 1
	ElseIf KeyDown(KEY_S) And KeyDown(KEY_A)'sa
		RotateEntity shirt001,0,-45,0
		anState = 1
	ElseIf KeyDown(KEY_S) And KeyDown(KEY_D)'sd
		RotateEntity shirt001,0,45,0
		anState = 1
	ElseIf KeyDown(KEY_W)'w
		RotateEntity shirt001,0,180,0
		anState = 1
	ElseIf KeyDown(KEY_A)'a
		RotateEntity shirt001,0,-90,0
		anState = 1
	ElseIf KeyDown(KEY_S)'s 
		RotateEntity shirt001,0,0,0
		anState = 1
	ElseIf KeyDown(KEY_D)'d
		RotateEntity shirt001,0,90,0
		anState = 1
	End If
	
	Select anState
		Case 0
			'no animation, 0
			anim_time = 0
		Case 1
			'walk animation, 1-5
			anim_time = anim_time + .15
	End Select
	
	If(anim_time > 5) Then
		anim_time = 1
	End If
	SetAnimTime(shirt001 , anim_time#)
	
	RenderWorld()
	
	BeginMax2D()
		SetColor(255,255,255)

		DrawText "AnimLength: " + String(AnimLength(shirt001) ) , 824 , 515
		DrawText "AnimTime: " + String(AnimTime(shirt001) ) , 824 , 500
		DrawText "AnimSeq: " + String(AnimSeq(shirt001)),824,485
	EndMax2D()

	Flip(0)
	Delay(1) 'Give system time to catch up on things.
Wend
End


Last edited 2012

Last edited 2012


YellBellzDotCom(Posted 2012) [#2]
Definitely something wrong with the model. I used the same code for all my other clothing items and it worked fine. I checked all the bones and names of the borked model, but couldn't find anything, finally just created a new shirt model and everything is A-OK!!!

Wheeew!