Animated & non Animated meshes
Blitz3D Forums/Blitz3D Beginners Area/Animated & non Animated meshes
| ||
How I can check before if a mesh is animated or not animated in order to use LoadMesh or LoadANimMesh respectively Thanks! |
| ||
Ok, I found a solution. If I load a static mesh with the LoadAnimMesh function then its width, height or depth are negatives |
| ||
Problem is, LoadAnimMesh, is used for groups of meshes too, not just animated meshes. Try using the animate command. I'm sure this will return a 0 value from the animating() function is the mesh isn't animating. |
| ||
I tried but not worked. Take a look here just for your info: http://www.blitzbasic.com/Community/posts.php?topic=77956 |
| ||
Thats odd. If it's an animating mesh, it should animate. And if it animates, it should return true on the animating flag. As long as you ghot it working though :o) |
| ||
Yap, try this:Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 arialfont = LoadFont("Arial", 16) SetFont arialfont model% = LoadMesh("the_static_model") If model <> 0 Then PositionEntity model,0,0,MeshDepth(model)*2 ; Load mesh animmodel% = LoadAnimMesh("the_static_model") If animmodel <> 0 Animate animmodel anim_length% = AnimLength(animmodel) animate_ing% = Animating(animmodel) EndIf While Not KeyDown( 1 ) RenderWorld UpdateWorld If animmodel <> 0 Text 0,0,"Model is valid" Text 0,20, "Width = "+MeshWidth(animmodel) Text 0,40, "Height = "+MeshHeight(animmodel) Text 0,60, "Depth = "+MeshDepth(animmodel) Text 0,80, "Anim length = "+anim_length Text 0,100, "Animating = "+animate_ing Else Text 0,0,"Model is not valid" EndIf Flip Wend End |
| ||
I dont think you can do this line:If animmodel <> 0 ;code endif You have to do this: If animmodel < 0 If animmodel > 0 ;code endif endif also,NEVER load a model as floating point |
| ||
NEVER load a model as floating point Where did I do this? |
| ||
You can use <>, it means unequal to. The command AnimLength(), if it is zero, the mesh is most likely not animated. Usually, .b3d files have a root which is not animated. In that case, you'll need to use GetChild to obtain the child that contains the animation. If you load the mesh using LoadAnimMesh, and decide that it isn't animated, you can collapse the mesh instead of freeing it and loading it again using LoadMesh. I've written a routine 'CopyMeshAt' which could come in handy for that. It copies a mesh, and applies the original entities rotation/scaling/position to the copied mesh. Usage: mesh2 = CopyMeshAt(mesh) instead of mesh2 = CopyMesh(mesh) or mesh2 = CopyEntity(mesh) |
| ||
I dont think you can do this line: Yes you can. also,NEVER load a model as floating point % is the symbol for an integer, floats are designated with #. |
| ||
My bad. |