MocoCreate
result as real=MocoCreate( );
This starts the engine.
Call it before you call any of the other functions.
MocoDestroy
result as real=MocoDestroy( );
This destroys the engine.
Call it when you don't need it any longer.
It frees all resources used and loaded by the dll,
i.e. the models, dmf light attributes and other resources used by the dll internally.
It does not and cannot free the textures you loaded.
ModelCreate
result as real=ModelCreate( filename as string );
This creates/loads a model which can be displayed and/or added to the collision system.
Currently only Deled dmf scenes are supported.
The function returns a handle to the model which is needed in other functions.
filename: filename of the model
ObjectDestroy
result as real=ObjectDestroy( model as real );
destroys objects created with ModelCreate, ECAddActor, SCAddActor
ModelCountMeshes
result as real=ModelCountMeshes( model as real );
Returns the number of meshes of the model.
model: model created with ModelCreate
ModelGetMeshName
result as string=ModelGetMeshName( model,mesh as real );
Returns the name of a mesh as string.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
ModelCountIndices
result as real=ModelCountIndices( model,mesh as real );
Returns the number of vertex indices of a mesh.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
ModelGetVertex
result as real=ModelGetVertex( model,mesh,vertexIndex,index as real );
Returns the vertex of a mesh.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
vertexIndex: 0 to ModelCountIndices-1
index: 0/1/2 for x/y/z
ModelGetTexCoord
result as real=ModelGetTexCoord( model,mesh,vertexIndex,index as real );
Returns the texture coordinate of a mesh.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
vertexIndex: 0 to ModelCountIndices-1
index: 0/1/ for u/v
ModelCountLightmapCoords
result as real=ModelCountLightmapCoords( model,mesh as real );
Returns the number of lightmap texture coordinates of a mesh
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
ModelGetLightmapCoord
result as real=ModelGetLightmapCoord( model,mesh,vertexIndex,index as real );
Returns the lightmap texture coordinate of a mesh.
You can test if the mesh has lightmap coordinates with ModelCountLightmapCoords
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
vertexIndex: 0 to ModelCountIndices-1
index: 0/1/ for u/v
CalculateTriNormal
result as real=CalculateTriNormal( model,mesh,vertexIndex as real );
Calculates the normal of a triangulated polygon.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
vertexIndex: 0 to ModelCountIndices-1
The polygon used is defined by vertexIndex,vertexIndex+1,vertexIndex+2
To get the normal you have to use GetTriNormal
GetTriNormal
result as real=GetTriNormal( index as real );
Returns the normal calculated with CalculateTriNormal
index: 0/1/2 for x/y/z
ModelGetTextureIndex
result as real=ModelGetTextureIndex( model,mesh as real );
Returns the texture index of a mesh.
The index is in the range 0 to "used textures"-1
Each texture has a unique id.
Textures which appear in a dmf but are not used by the meshes get no id.
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
ModelGetTextureFile
result as string=ModelGetTextureFile( model,mesh,texture as real );
Returns the texture or lightmap filename assigned to a mesh
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
texture: 0 for texture, 1 for lightmap texture
ModelGetAABBMin
result as real=ModelGetAABBMin( model,mesh,index as real );
Returns the minimum values of the axis aligned bounding box of a mesh
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
index: 0/1/2 for x/y/z
ModelGetAABBMax
result as real=ModelGetAABBMax( model,mesh,index as real );
Returns the maximum values of the axis aligned bounding box of a mesh
model: model created with ModelCreate
mesh: 0 to ModelCountMeshes-1
index: 0/1/2 for x/y/z
SCAddCollisionMap
result as real=SCAddCollisionMap( model, as posX,, posY, as posZ );
The function adds a model to the sphere sliding collision system.
Actors created with SCAddActor react to models added if they have the same group.
model: model created with ModelCreate
posX, posY, posZ: position of the model
It returns a handle which is used by other functions.
SCRemoveCollisionMap
result as real=SCRemoveCollisionMap( map as real );
The function removes a model from the sphere sliding collision system.
Actors don't react to the model anymore.
map: handle returned by SCAddCollisionMap
SCSetCollisionGroup
result as real=SCSetCollisionGroup( map,group as real );
Sets the group of the collsion map.
Only actors with the same group as the map are tested for collisions.
map: handle returned by SCAddCollisionMap
group: any number
SCAddActor
result as real=SCAddActor( posX, as posY,, posZ as real );
Adds an actor to the sphere sliding collision system.
posX, posY, posZ: position where the actor should be created at
returns a handle to the actor
SCSetActorGroup
result as real=SCSetActorGroup( actor,group as real );
Sets the group of an actor.
Only actors with the same group as the map are tested for collisions.
actor: actor created with SCAddActor
group: any number
SCSetActorSize
result as real=SCSetActorSize( actor,size as real );
Sets the size of an actor,i.e the sphere radius.
actor: actor created with SCAddActor
size: any positive number, default is 32
SCSetActorGravity
result as real=SCSetActorGravity( actor,gravity as real );
Sets the gravity of the actor.
actor: actor created with SCAddActor
gravity: any number, negative for falling down; default=0(no gravity)
SCSlidesDown
result as real=SCSlidesDown( actor,slideDown as real );
Defines if actors should slide downwards.
This only stops automatic sliding caused by gravity.
You can of course still walk downwards when set to false.
actor: actor created with SCAddActor
slideDown: true for sliding down, false for not sliding down.
SCMoveActor
result as real=SCMoveActor( actor,x,y,z as real );
Translates the actor to a new position.
actor: actor created with SCAddActor
x,y,z: distance to move in x, y, z
SCGetVelocity
result as real=SCGetVelocity( actor,axisIndex as real );
Returns the velocity of an actor.
actor: actor created with SCAddActor
axisIndex: 0/1/2 for x/y/z
SCCountCollisions
result as real=SCCountCollisions( actor as real );
Returns the number of collisions of the actor with the maps
actor: actor created with SCAddActor
SCGetCollisionPosition
result as real=SCGetCollisionPosition( actor,index,ind as real );
Returns the position of a collision.
actor: actor created with SCAddActor
index: 0 to SCCountCollisions-1
ind: 0/1/2 for x/y/z
SCGetCollisionNormal
result as real=SCGetCollisionNormal( actor,index,ind as real );
Returns the normal of a collision.
actor: actor created with SCAddActor
index: 0 to SCCountCollisions-1
ind: 0/1/2 for x/y/z
SCUpdateActor
result as real=SCUpdateActor( actor as real );
Use this to update an actor.
Without updating the actor does not react to collisions.
actor: actor created with SCAddActor
ECAddActor
result as real=ECAddActor( posX, as posY,, posZ as real );
Adds an actor to the ellipsoid sliding collision system.
posX, posY, posZ: position where the actor should be created at
returns a handle to the actor
ECSetActorGroup
result as real=ECSetActorGroup( actor,group as real );
Sets the group of an actor.
Only actors with the same group as the map are tested for collisions.
actor: actor created with ECAddActor
group: any number
ECSetActorSize
result as real=ECSetActorSize( actor,sizeX, as sizeY,, sizeZ as real );
Sets the size of an actor.
actor: actor created with ECAddActor
sizeX, sizeY, sizeZ: size of actor ( 3 values?)
ECSetSlideOrBounce
result as real=ECSetSlideOrBounce( actor,sb as real );
Defines if the actor should slide along or bounce against meshes.
Sliding and bouncing depend on friction and bounce factor, too.
actor: actor created with ECAddActor
sb: 0=slide; 1=bounce
ECSetActorBounce
result as real=ECSetActorBounce( actor,bounce as real );
Sets the bounce factor.
Bouncing collisions must be activated with ECSetSlideOrBounce
actor: actor created with ECAddActor
bounce: 0(no bouncing) to 1(bounce forever); default is 0
ECSetActorFriction
result as real=ECSetActorFriction( actor,friction as real );
Sets the actor's friction.
actor: actor created with ECAddActor
friction: 0(no friction) to 100(no movement)
ECSetActorGravity
result as real=ECSetActorGravity( actor,gravity as real );
Sets the actor's gravity.
actor: actor created with ECAddActor
gravity: any number, negative for falling down; default=0(no gravity)
ECSetActorSolid
result as real=ECSetActorSolid( actor,solid as real );
Defines if the actor is solid or not
Actor still generates collision events but it doesn't "block" others
actor: actor created with ECAddActor
solid: true for solid, false for not; default is true
ECSetActorActive
result as real=ECSetActorActive( actor,active as real );
Enables or disables the actor collisions.
actor: actor created with ECAddActor
active: true(enabled), false(disabled)
ECSetActorMaxRecursion
result as real=ECSetActorMaxRecursion( actor,depth as real );
Sets the actor's maximum recursion depth.
In a very complex collision map or when the actor moves very fast it may be
neccessary to increase the recursion depth.
This makes it slower but more precise.
actor: actor created with ECAddActor
depth: 1 to 255; default=5
ECAddCollisionMap
result as real=ECAddCollisionMap( model, as posX,