My Animation Headache

Blitz3D Forums/Blitz3D Beginners Area/My Animation Headache

PureDocHale(Posted 2013) [#1]
Hello again everyone, today I spent some time just playing with some new animated models from my project group. And the "soldier" I am trying to animate is a .x mesh with the animations in the file. I tried using loadanimmesh(), and animate commands to no avail. What am I doing wrong? Thank you everyone

-apologies idk how to make a scroll box chatty thingy

;======================================
Graphics3D 1280,720,32,1
SetBuffer BackBuffer()

Global light = CreateLight()
RotateEntity light,90,0,0

Global pivot = CreatePivot()
Global cam = CreateCamera(pivot)
PositionEntity cam,0,1,0

Global playerspivot = CreatePivot()
Global mesh = LoadAnimMesh("soldier.x")

ScaleEntity mesh,.1,.1,.1
RotateEntity mesh,-90,0,180
EntityParent mesh,playerspivot

Animate mesh,1,1

PositionEntity playerspivot,0,0,20

While Not KeyDown(1)

UpdateWorld
RenderWorld

movement()

Flip
Wend
End


Function movement()

If KeyDown(17) ;forward w
MoveEntity pivot,0,0,0.05
EndIf

If KeyDown(31) ;backwards s
MoveEntity pivot,0,0,-0.05
EndIf


If KeyDown(30) ;straff a
MoveEntity pivot,-.05,0,0
EndIf

If KeyDown(32) ;straff d
MoveEntity pivot,.05,0,0
EndIf

If KeyDown(17) And KeyDown(42) ;forward w run
MoveEntity pivot,0,0,.08
EndIf

If KeyDown(31) And KeyDown(42) ;backwards s run
MoveEntity pivot,0,0,-.08
EndIf


End Function


Yasha(Posted 2013) [#2]
To put code in a scrolling box, put it between {codebox} and {/codebox} (but replace the {} with []). See the "forum codes" link above the reply box for more.


Anyway... one potential problem with .x format model files is that the .x format has been updated a few times since B3D was made, but B3D's .x importer hasn't. If the files are in DirectX8 or later format, they won't work correctly, and many tools don't provide any way to control or check this (in fact, many tools would see no reason not to use a newer version of the format).

If it's possible, using the .b3d format is highly recommended as it's the only one of the native formats that actually matches up with B3D's internal capabilities properly. MD2 is also serviceable in a pinch. .3ds is pretty much useless for characters. (There are also importers in the code archives for some non-native file types, such as .obj and MD3; these are of variable quality.)

I have no idea if this is the actual problem, but it's worth mentioning.


RemiD(Posted 2013) [#3]
I don't know about .x files because i only use .b3d files.
With .b3d files,
First, you need to load the animated mesh with :
SkinnedMesh = LoadAnimMesh("SkinnedMesh.b3d")


Then, you need to retrieve the animation sequences :
SeqStandIdle = ExtractAnimSeq(SkinnedMesh,5,15)
SeqWalkForward = ExtractAnimSeq(SkinnedMesh,20,40)
SeqWalkBackward = ExtractAnimSeq(SkinnedMesh,45,65)


Then, to animate your mesh in the loop :
A way :
If(Not Animating(SkinnedMesh))
 Animate(SkinnedMesh,3,1,SeqWalkForward)
EndIf


Another way :
If(AnimSeq(SkinnedMesh) <> SeqWalkForward)
 Animate(SkinnedMesh,1,1,SeqWalkForward)
ElseIf(AnimSeq(SkinnedMesh) = SeqWalkForward And AnimTime(SkinnedMesh) = 40)
 Animate(SkinnedMesh,1,1,SeqWalkForward)
EndIf

The second way is more complicated to understand and to use but will be necessary when there are complex chaining of different sequences.


jfk EO-11110(Posted 2013) [#4]
it is also very likely that you're using a dx9 x file, but blitz supports dx7 x only. Get eg. FRAGMOTION and convert it to B3D.


Imperium(Posted 2013) [#5]
Is "fragmotion" really the best solution for animating/convert modelings into B3d format? Here are two other programs I am considering:
http://3doc.i3dconverter.com/
http://www.unwrap3d.com/u3d/index.aspx

Any thoughts on these?


Kryzon(Posted 2013) [#6]
There's also the free route with Blender3D: http://blitzbasic.com/Community/posts.php?topic=100592


RemiD(Posted 2013) [#7]
From my tests, Fragmotion is good to create low tris meshes and materials, but very limited and difficult to use to UVMap a mesh.

I suggest to use Wings3d to UVMap a mesh.

Fragmotion is really easy to use to create a skeleton (with joints), to set the influence of some joints over some vertices, to create animation sequences (with poses)

The .b3d files are exported correctly.

I recommend it.


Imperium(Posted 2013) [#8]
Personally I have adapted to using Maya's UV mapping and it works quite well. I just can't afford a single dime on any new programs right now. I will keep Fragmotion in mind because of its proven track record with Blitz. Thanks!