Xors3d Engine
Shapes

Modules

 Compound

Functions

void xEntityAddBoxShape (Entity *entity, float mass, float width=0.0f, float height=0.0f, float depth=0.0f)
 Creates a box shape and attaches it to the entity.
void xEntityAddCapsuleShape (Entity *entity, float mass, float radius=0.0f, float height=0.0f)
 Creates a capsule shape and attaches it to the entity.
void xEntityAddConcaveShape (Entity *entity, float mass)
 Creates a concave shape and attaches it to the entity.
void xEntityAddConcaveShapeProxy (Entity *entity, Entity *proxy, float mass)
 Creates a concave shape using information about vertices and indices of the proxy entity and attaches it to the main entity.
void xEntityAddConeShape (Entity *entity, float mass, float radius=0.0f, float height=0.0f)
 Creates a cone shape and attaches it to the entity.
void xEntityAddConvexShape (Entity *entity, float mass)
 Creates a convex shape and attaches it to the entity.
void xEntityAddConvexShapeProxy (Entity *entity, Entity *proxy, float mass)
 Creates a convex shape using information about vertices and indices of the proxy entity and attaches it to the main entity.
void xEntityAddCylinderShape (Entity *entity, float mass, float width=0.0f, float height=0.0f, float depth=0.0f)
 Creates a cylinder shape and attaches it to the entity.
void xEntityAddDummyShape (Entity *entity)
 Creates a dummy shape and attaches it to the entity.
void xEntityAddSphereShape (Entity *entity, float mass, float radius=0.0f)
 Creates a sphere shape and attaches it to the entity.
void xEntityAddTerrainShape (Entity *entity)
 Creates a static shape for a terrain.
void xEntityAddTriMeshShape (Entity *entity)
 Creates a trimesh (triangle mesh) shape and attaches it to the entity.
void xEntityAddTriMeshShapeProxy (Entity *entity, Entity *proxy)
 Creates a trimesh (triangle mesh) shape using information about vertices and indices of the proxy entity and attaches it to the main entity.
void xEntityAttachBody (Entity *entity, IBody *body)
 Attaches a previously detached body.
IBody * xEntityDetachBody (Entity *entity)
 Detaches a body from an entity.
void xFreeEntityBody (Entity *entity)
 Frees the body of an entity.

Function Documentation

void xEntityAddDummyShape ( Entity *  entity)

Creates a dummy shape and attaches it to the entity.

A dummy shape has no mass and collision body.

Parameters:
entityEntity handle
void xEntityAddBoxShape ( Entity *  entity,
float  mass,
float  width = 0.0f,
float  height = 0.0f,
float  depth = 0.0f 
)

Creates a box shape and attaches it to the entity.

Set any dimension of the box shape to zero or less than zero and the shape will fit the dimensions of the entity automatically.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
widthWidth of the body
heightHeight of the body
depthDepth of the body
void xEntityAddSphereShape ( Entity *  entity,
float  mass,
float  radius = 0.0f 
)

Creates a sphere shape and attaches it to the entity.

Set the radius of the sphere shape to zero or less than zero and the shape will fit the dimensions of the entity automatically.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
radiusRadius of the body
void xEntityAddCapsuleShape ( Entity *  entity,
float  mass,
float  radius = 0.0f,
float  height = 0.0f 
)

Creates a capsule shape and attaches it to the entity.

Set any dimension of the capsule shape to zero or less than zero and the shape will fit the dimensions of the entity automatically.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
radiusRadius of the body
heightHeight of the body
void xEntityAddConeShape ( Entity *  entity,
float  mass,
float  radius = 0.0f,
float  height = 0.0f 
)

Creates a cone shape and attaches it to the entity.

Set any dimension of the cone shape to zero or less than zero and the shape will fit the dimensions of the entity automatically.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
radiusRadius of the body
heightHeight of the body
void xEntityAddCylinderShape ( Entity *  entity,
float  mass,
float  width = 0.0f,
float  height = 0.0f,
float  depth = 0.0f 
)

Creates a cylinder shape and attaches it to the entity.

Set any dimension of the cylinder shape to zero or less than zero and the shape will fit the dimensions of the entity automatically.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
widthWidth of the body
heightHeight of the body
depthDepth of the body
void xEntityAddTriMeshShape ( Entity *  entity)

Creates a trimesh (triangle mesh) shape and attaches it to the entity.

Created trimesh shape is static which means that moving of vertices won't affect the shape.

Parameters:
entityEntity handle
void xEntityAddTriMeshShapeProxy ( Entity *  entity,
Entity *  proxy 
)

Creates a trimesh (triangle mesh) shape using information about vertices and indices of the proxy entity and attaches it to the main entity.

Created trimesh shape is static which means that moving of vertices won't affect the shape.
Usually proxy entity is a lowpoly version of the main entity. Proxy entity may be freed after using in this function.

Parameters:
entityEntity handle
proxyProxy entity handle
void xEntityAddConvexShape ( Entity *  entity,
float  mass 
)

Creates a convex shape and attaches it to the entity.

The convex shape works much faster than the concave one. That's why the use of the convex shape is more preferable if it fits your needs.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
void xEntityAddConvexShapeProxy ( Entity *  entity,
Entity *  proxy,
float  mass 
)

Creates a convex shape using information about vertices and indices of the proxy entity and attaches it to the main entity.

The convex shape works much faster than the concave one. That's why the use of the convex shape is more preferable if it fits your needs.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body. Usually proxy entity is a lowpoly version of the main entity. Proxy entity may be freed after using in this function.
Parameters:
entityEntity handle
proxyProxy entity handle
massMass of the body
void xEntityAddConcaveShape ( Entity *  entity,
float  mass 
)

Creates a concave shape and attaches it to the entity.

Unlike a convex shape a concave shape can have dents and holes. For instance, a torus will have a hole if it was created as a concave shape.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body.
Parameters:
entityEntity handle
massMass of the body
void xEntityAddConcaveShapeProxy ( Entity *  entity,
Entity *  proxy,
float  mass 
)

Creates a concave shape using information about vertices and indices of the proxy entity and attaches it to the main entity.

Unlike a convex shape a concave shape can have dents and holes. For instance, a torus will have a hole if it was created as a concave shape.

Note:
Setting mass to zero creates a static (non-dynamic) rigid body. Usually proxy entity is a lowpoly version of the main entity. Proxy entity may be freed after using in this function.
Parameters:
entityEntity handle
proxyProxy entity handle
massMass of the body
void xEntityAddTerrainShape ( Entity *  entity)

Creates a static shape for a terrain.

Can be used only with the terrains.

Parameters:
entityEntity handle
void xEntityAttachBody ( Entity *  entity,
IBody *  body 
)

Attaches a previously detached body.

In combination with xEntityDetachBody() this function is useful if you need to switch bodies between two or more shapes.

Parameters:
entityEntity handle
bodyBody handle
IBody* xEntityDetachBody ( Entity *  entity)

Detaches a body from an entity.

In combination with xEntityAttachBody() this function is useful if you need to switch bodies between two or more shapes.

Note:
A detached body is still active and takes part in the physics simulation. Use xEntityDisableSimulation() if the body is detached for a long time and should be disabled.
Warning:
Currently only primitive-shape bodies (box, sphere, cone, capsule, cylinder) are detachable.
Concave, convex, trimesh, terrain are not detachable.
Parameters:
entityEntity handle
void xFreeEntityBody ( Entity *  entity)

Frees the body of an entity.

Parameters:
entityEntity handle.