Home
Products
Community
Manuals
Contact
Login or Signup

Blitz3D Docs -> 3D - A-Z -> L -> LoadMesh

LoadMesh(filename$,[Parent])

Parameters:

Filename$ - Name of the file containing the model to load.
Parent (optional) - Specify an entity to act as a Parent to the loaded mesh.

Description:

LoadMesh, as the name suggests, Loads a mesh from an .X, .3DS or .B3D file (Usually created in advance by one of a number of 3D model creation packages) and returns the mesh handle.

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

The optional parent parameter allows 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, MeshCullBox.

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

Comments

yazzgoth(Posted 1+ years ago)
MAV: Entity does not exist!

line: PositionEntity drum,0,0,MeshDepth(drum)*2


degac(Posted 1+ years ago)
ehm....you need a valid .3ds file (in this case) placed in the directory media/oil-drum/....


Ben(t)(Posted 1+ years ago)
I can't get .b3d files to load blitz3d only seems to load .x .3ds and .md2


thelizardking(Posted 1+ years ago)
ben(t): thatz because u have an old version of b3d. just update, cause i had the same problem and then i updated, and, viola! it worked. just a bug i ges


Rob Farley(Posted 1+ years ago)
Not a bug, b3d format was implemented in v1.75, it didn't exist beforehand.


Beaker(Posted 1+ years ago)
LoadMesh requires texture files (PNG/BMP/JPG) to be in the same folder as the B3D/X/3DS files that require them.


Blitz3D Manual Forum

BlitzPlus Equivalent Command