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,, posY, as posZ );

The function adds a model to the ellipsoid sliding collision system.
Actors created with ECAddActor react to models added if they have the same group.
model: model created with ModelCreate
posX, posY, posZ: position of the model

ECRemoveCollisionMap

result as real=ECRemoveCollisionMap( model as real );

Removes the map from collision tests.
It does not destroy the model/map
model: model created with ModelCreate

ECSetCollisionGroup

result as real=ECSetCollisionGroup( model,group as real );

Sets the group of the collision map.
model: model created with ModelCreate

ECSetActive

result as real=ECSetActive( model,active as real );

Enables or disables the collision map
model: model created with ModelCreate
active: true/false

ECSetSolid

result as real=ECSetSolid( model,solid as real );

Defines if the static model is solid or not
Model still generates collision events but it doesn't "block" others
model: model created with ModelCreate
solid: true for solid, false for not; default is true

ECSetBounce

result as real=ECSetBounce( model,bounce as real );

Sets the bounce factor of the collision map
model: model created with ModelCreate
bounce: 0(don't bounce) to 1(bounce forever)

ECSetFriction

result as real=ECSetFriction( model,friction as real );

model: model created with ModelCreate
friction: 0(no friction) to 100(no movement)

ECMoveActor

result as real=ECMoveActor( actor,x,y,z as real );

Moves the actor.
actor: actor created with ECAddActor
x, y, z: distance

ECAccelerateActor

result as real=ECAccelerateActor( actor,x,y,z as real );

Accelerates the actor in a direction.
If friction is not set too high the actor will continue moving.
It's useful for bouncing collision, too because with ECMOveActor you won't
see the actor bouncing.
actor: actor created with ECAddActor

ECUpdateActor

result as real=ECUpdateActor( actor,delta as real );

Use this function to update the actor.
actor: actor created with ECAddActor
delta: deltatime

ECJump

result as real=ECJump( actor,height,speed as real );

Lets the actor jump
actor: actor created with ECAddActor
height: the distance
speed: the higher the faster the actor reaches the height

ECInGround

result as real=ECInGround( actor as real );

Returns true if the actor is in ground?
actor: actor created with ECAddActor

ECGetVelocity

result as real=ECGetVelocity( actor,index as real );

Returns the velocity of the acor.
actor: actor created with ECAddActor
index: 0/1/2 for x/y/z

ECVelocityCollided

result as real=ECVelocityCollided( actor as real );

Returns true if the actor collided due to velocity.
actor: actor created with ECAddActor

ECGravityCollided

result as real=ECGravityCollided( actor as real );

Returns true if the actor collided due to gravity
actor: actor created with ECAddActor

ECCountCollisions

result as real=ECCountCollisions( actor as real );

Returns the number of collisions caused by the actor.
actor: actor created with ECAddActor

ECGetCollidedObject

result as real=ECGetCollidedObject( actor,index as real );

Returns the object the actor collided with.
actor: actor created with ECAddActor
index: 0 to ECCountCollisions-1

ECGetCollisionPosition

result as real=ECGetCollisionPosition( actor,index,ind as real );

Returns the position of a collision.
actor: actor created with ECAddActor
index: 0 to ECCountCollisions-1
ind: 0/1/2 for x/y/z

ECGetCollisionNormal

result as real=ECGetCollisionNormal( actor,index, as ind );

Returns the normal of a collision.
actor: actor created with ECAddActor
index: 0 to ECCountCollisions-1
ind: 0/1/2 for x/y/z

GetActorPosition

result as real=GetActorPosition( actor,index as real );

The function returns the position of an actor created with ECAddActor or SCAddActor
Actors change their position due to collision response or gravity.
It is therefore neccessary to get the new position after updating the collision system.
actor: handle of actor
index: 0/1/2 for x/y/z

GetDistance

result as real=GetDistance( model,mesh,x,y,z as real );

The function returns the distance from a mesh to a point.
model = handle returned by ModelCreate
mesh = 0 to ModelCountMeshes-1
x, y, z = position of point

RaycastModelIntersect

result as real=RaycastModelIntersect( model,rx,ry,rz,rvx,rvy,rvz as real );

model = handle returned by ModelCreate
rx, ry, rz = ray start position
rvx, rvy, rvz = position ray should cast through
The function returns true if the ray intersects the model.
Use GetRayCollisionPosition and GetRayCollisionNormal to get the
collision position and normal.

GetRayCollisionPosition

result as real=GetRayCollisionPosition( index as real );

The function returns the position of a preceeding RaycastModelIntersect call
index is 0/1/2 for x/y/z

GetRayCollisionNormal

result as real=GetRayCollisionNormal( index as real );

The function returns the normal of a preceeding RaycastModelIntersect call
index is 0/1/2 for x/y/z

SphereContainsSphere

result as real=SphereContainsSphere( x1,y1,z1,r1,x2,y2,z2,r2 as real );

The function checks if a sphere at position x1, y1, z1 and radius r1
contains a sphere at position x2, y2, z2 and radius r2.
This can be used for simple collision tests.
result is
0 = spheres don't overlap
1 = sphere1 contains sphere2 fully
2 = sphere1 contains sphere2 partially

DMFLoadLights

result as real=DMFLoadLights( filename as string );

Opens a Deled dmf file(V1.1 or higher) and reads informations about lights stored in it.

filename is the name of the dmf file you want to load.
The function returns the number of lights defined in the dmf.

The informations can be read with MocoGetLightAttribute
It does NOT create any lights in the scene.
You can use it to get the attributes of lights you created in DeleD.
What you do with this attributes is up to you.
You can create lights in gml with it or even use it to position other
objects like doors, enemies, items and so on.

DMFGetLightAttribute

result as string=DMFGetLightAttribute( light,index as real );

This function returns an attribute of a light stored in a dmf.

light is the light you want to access, the first light is 1
index is the attribute of the light you want to access, the first attribute is 1
The function returns the attribute as a string.

There is no range checking, so don't try to access non existing lights or attributes.
Usually a pointlight in dmf has attributes 1 to 19:

1=type of light
2=constant attenuation
3=linear attenuation
4=quadratic attenuation
5=range
6,7,8=center/position
9=flash
10=active
11,12,13=diffuse color
14,15,16=specular color
17=intensity
18=id
19=name

But because the function has no range checking you can edit the dmf with a text editor
and add as many attributes as you want to the light(all attributes seperated by semicolon)