# Command: LoadMesh

LoadMesh ( file$[,parent] )

Parameters:

file$ - filename of mesh parent (optional) - parent entity of mesh

Description:

Loads a mesh from a .x or .3ds file and returns the mesh's handle.

Any hierarchy and animation information in the file will be ignored. Use LoadAnimMesh to maintain hierarchy and animation information.

The optional parent parameter allow you to specify a parent entity for the mesh so that when the parent is moved the child mesh will move with it. However, this relationship is one way; applying movement commands to the child will not affect the parent.

Specifying a parent entity will still result in the mesh being created at position 0,0,0 rather than at the parent entity's position.

See also: LoadAnimMesh.

Example:

; LoadMesh Example ; ---------------- Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 ; Load mesh drum=LoadMesh("media/oil-drum/oildrum.3ds") PositionEntity drum,0,0,MeshDepth(drum)*2 While Not KeyDown( 1 ) RenderWorld Flip Wend End

Index