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)
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)
Function CopyMeshAt(mesh) mesh2 = CopyMesh(mesh) ScaleMesh mesh2, EntityWidth(mesh), EntityHeight(mesh), EntityDepth(mesh) RotateMesh mesh2, GlobalEntityPitch(mesh), GlobalEntityYaw(mesh), GlobalEntityRoll(mesh) PositionMesh mesh2, EntityX(mesh,1), EntityY(mesh,1), EntityZ(mesh,1) Return mesh2 End Function Function EntityWidth#( mesh ) If EntityClass$(mesh) <> "Mesh" Then Return 1 If MeshWidth(mesh) = 0 Then Return 1 TFormPoint MeshWidth(mesh), 0, 0, mesh, 0 xx# = TFormedX() yy# = TFormedY() zz# = TFormedZ() TFormPoint 0, 0, 0, mesh, 0 xx# = TFormedX()-xx yy# = TFormedY()-yy zz# = TFormedZ()-zz ll# = Sqr(xx * xx + yy * yy + zz * zz) / MeshWidth(mesh) If ll = 0 Then ll = 1 Return ll End Function Function EntityHeight#( mesh ) If EntityClass$(mesh) <> "Mesh" Then Return 1 If MeshHeight(mesh) = 0 Then Return 1 TFormPoint 0, MeshHeight(mesh), 0, mesh, 0 xx# = TFormedX() yy# = TFormedY() zz# = TFormedZ() TFormPoint 0, 0, 0, mesh, 0 xx# = TFormedX()-xx yy# = TFormedY()-yy zz# = TFormedZ()-zz ll# = Sqr(xx * xx + yy * yy + zz * zz) / MeshHeight(mesh) If ll = 0 Then ll = 1 Return ll End Function Function EntityDepth#( mesh ) If EntityClass$(mesh) <> "Mesh" Then Return 1 If MeshDepth(mesh) = 0 Then Return 1 TFormPoint 0, 0, MeshDepth(mesh), mesh, 0 xx# = TFormedX() yy# = TFormedY() zz# = TFormedZ() TFormPoint 0, 0, 0, mesh, 0 xx# = TFormedX()-xx yy# = TFormedY()-yy zz# = TFormedZ()-zz ll# = Sqr(xx * xx + yy * yy + zz * zz) / MeshDepth(mesh) If ll = 0 Then ll = 1 Return ll End Function Function GlobalEntityPitch#(entity) pit# = Int(EntityPitch(entity)*1000)/1000.0 Return pit End Function Function GlobalEntityYaw#(entity) pit# = Int(EntityPitch(entity)*1000)/1000.0 yaw# = Int(EntityYaw(entity)*1000)/1000.0 If Abs(pit)>GIMBAL_LIMIT temp = CreatePivot(entity) EntityParent temp, GetParent(entity) TurnEntity temp,Sgn(pit)*-90.0,0,0 yaw# = Int(EntityYaw(temp)*1000)/1000.0 FreeEntity temp EndIf Return yaw End Function Function GlobalEntityRoll#(entity) pit# = Int(EntityPitch(entity)*1000)/1000.0 rol# = Int(EntityRoll(entity)*1000)/1000.0 If Abs(pit)>GIMBAL_LIMIT temp = CreatePivot(entity) EntityParent temp, GetParent(entity) TurnEntity temp,Sgn(pit)*-90.0,0,0 rol# = Int(EntityRoll(temp)*1000)/1000.0 FreeEntity temp EndIf Return rol End Function