Animation help!

Blitz3D Forums/Blitz3D Programming/Animation help!

Im messing around with the B3D demo to see how easy it is and evalute it if I should buy it (I do have B+)

Im having problems animating a model. I did check it with CountChildren and it returned 5! That does sound about right.

Whats wrong?

AppTitle "Blitz3D"
Graphics3D 640,480,32,2
SetBuffer BackBuffer()

Global Camera=CreateCamera()
PositionEntity Camera,5,5,20
RotateEntity Camera,0,180,0

Global MP40=LoadAnimMesh("mp40.3ds")
PositionEntity MP40,0,0,0
RotateEntity MP40,270,0,0
Animate MP40,1,1,3

Global Light=CreateLight()

While Not KeyHit(1)
UpdateWorld
RenderWorld
Wend
End

try "Animate MP40" and leave the default paramiters, or
Animate MP40,1,1.

I too have had problems animating .3ds files. So, as a result of having no hair left from pulling it all out, I downloaded and istalled the B3D MAX Pipeline.

I don't know if you have MAX or access to it, but the B3D Pipline really is worth a great deal.

I believe someone even told me that B3D will not use .3ds animation...I very well could be wrong though.

Whenever you want to access children of an animated mesh, make sure to parse the whole hierarchy RECURSIVELY. Because your top parent handle may have 5 Children (eg. upper arms and legs and neck), but the also have further children (head, lower arms, legs) and so on. wait a minute, I posted aome code some time ago, gotta search...

ok:

create your collection of recursive entity commands for animated meshes:


Function EntityAnimColor(m,r,g,b)
 If EntityClass$(m)="Mesh"
  EntityColor m,r,g,b
 Endif
 For i=1 to CountChildren(m)
  ww=GetChild(m,i)
  EntityAnimColor(ww,r,g,b)
 Next
End Function
or
Function EntityAnimAlpha(m,a#)
 If EntityClass$(m)="Mesh"
  EntityAlpha m,a#
 Endif
 For i=1 to CountChildren(m)
  ww=GetChild(m,i)
  EntityAnimAlpha(ww,a#)
 Next
End Function



EntityClass$() is used to prevent trying to EntityAlpha eg. Bones, that wouldn't work.

Using a global counter variable in a recursive function call using CountChildren will give you the total number of children.

BTW FindChild can search for child names across all generations of a hierarchy.

Again me, seems like I misunderstood your question, however, may be useful anyway.

thanks for the help

does milkshape support exporting to .x model formats though?

Yes, Milkshape exports to most formats including .x and .b3d. Blitz3D can't use DX8 (i.e. boned animation) files though - best use the B3D format for that.