![]() |
Xors3d Engine
|
Functions | |
void | xClearCollisions () |
Clears the collision information list. | |
Entity * | xCollisionEntity (Entity *entity, int index) |
Returns the other entity involved in a particular collision. | |
float | xCollisionNX (Entity *entity, int index) |
Returns the x component of the normal of a particular collision. | |
float | xCollisionNY (Entity *entity, int index) |
Returns the y component of the normal of a particular collision. | |
float | xCollisionNZ (Entity *entity, int index) |
Returns the z component of the normal of a particular collision. | |
void | xCollisions (int srcType, int destType, int collideMethod, int response) |
Enables collisions between two different entity types. | |
Surface * | xCollisionSurface (Entity *entity, int index) |
Returns the handle of the surface belonging to the specified entity that was closest to the point of a particular collision. | |
float | xCollisionTime (Entity *entity, int index) |
Returns the time taken to calculate a particular collision. | |
int | xCollisionTriangle (Entity *entity, int index) |
Returns the index number of the triangle belonging to the specified entity that was closest to the point of a particular collision. | |
float | xCollisionX (Entity *entity, int index) |
Returns the world x coordinate of a particular collision. | |
float | xCollisionY (Entity *entity, int index) |
Returns the world y coordinate of a particular collision. | |
float | xCollisionZ (Entity *entity, int index) |
Returns the world z coordinate of a particular collision. | |
int | xCountCollisions (Entity *entity) |
Returns how many collisions an entity was involved in during the last xUpdateWorld() | |
void | xEntityBox (Entity *entity, float x, float y, float z, float width, float height, float depth) |
Sets the dimensions of an entity's collision box. | |
Entity * | xEntityCollided (Entity *entity, int typeID) |
Returns true if an entity collided with any other entity of the specified type. | |
void | xEntityPickMode (Entity *entity, int mode, bool obscurer=true, bool recursive=true) |
Sets the pick mode for an entity. | |
void | xEntityRadius (Entity *entity, float xRadius, float yRadius=0.0f) |
Sets the radius of an entity's collision sphere. | |
void | xEntityType (Entity *entity, int typeID, bool recurse=false) |
Sets the collision type for an entity. A collision type value of 0 indicates that no collision checking will occur with that entity. A collision value of [1; 999] will mean collision checking will occur. | |
void | xResetEntity (Entity *entity) |
Resets the collision state of an entity. |
void xCollisions | ( | int | srcType, |
int | destType, | ||
int | collideMethod, | ||
int | response | ||
) |
Enables collisions between two different entity types.
Entity types are just numbers you assign to an entity using xEntityType(). Then uses the entity types to check for collisions between all the entities that have those entity types. Where any ways of checking for collisions, as denoted by the method parameter. However, collision checking is always ellipsoid to something. In order to know what size a source entity is, you must first assign an entity radius to all source entities using xEntityRadius(). In the case of collision detection method SPHERETOSPHERE being selected, then the destination entities concerned will need to have an xEntityRadius() assigned to them too. In the case of method SPHERETOBOX being selected, then the destination entities will need to have an xEntityBox() assigned to them. Method SPHERETOTRIMESH requires nothing to be assigned to the destination entities. Engine not only check for collisions, but it acts upon them when it detects them too, as denoted by the response parameter. You have three options in this situation. You can either choose to make the source entity stop, slide or only slide upwards. All collision checking occurs, and collision responses are acted out, when xUpdateWorld() is called. Finally, every time the xCollisions() command is used, collision information is added to the collision information list. This can be cleared at any time using the xClearCollisions() command.
srcType | Entity type to be checked for collisions |
destType | Entity type to be collided with |
collideMethod | Collision detection method. See 'Collision types' for more information |
response | What the source entity does when a collision occurs. See 'Response types' for more information |
void xClearCollisions | ( | ) |
Clears the collision information list.
Whenever you use the Collisions command to enable collisions between two different entity types, information is added to the collision list. This command clears that list, so that no collisions will be detected until the Collisions command is used again.
void xResetEntity | ( | Entity * | entity | ) |
Resets the collision state of an entity.
entity | Entity handle |
void xEntityRadius | ( | Entity * | entity, |
float | xRadius, | ||
float | yRadius = 0.0f |
||
) |
Sets the radius of an entity's collision sphere.
An entity radius should be set for all entities involved in spherical collisions, which is all source entities (as collisions are always sphere-to-something), and whatever destination entities are involved in sphere-to-sphere collisions
entity | Entity handle |
xRadius | x radius of entity's collision sphere |
yRadius | y radius of entity's collision sphere |
void xEntityBox | ( | Entity * | entity, |
float | x, | ||
float | y, | ||
float | z, | ||
float | width, | ||
float | height, | ||
float | depth | ||
) |
Sets the dimensions of an entity's collision box.
entity | Entity handle |
x | x position of entity's collision box |
y | x position of entity's collision box |
z | x position of entity's collision box |
width | Width of entity's collision box |
height | Height of entity's collision box |
depth | Depth of entity's collision box |
void xEntityType | ( | Entity * | entity, |
int | typeID, | ||
bool | recurse = false |
||
) |
Sets the collision type for an entity. A collision type value of 0 indicates that no collision checking will occur with that entity. A collision value of [1; 999] will mean collision checking will occur.
entity | Entity handle |
typeID | Collision type of entity. Must be in the range [0; 999] |
recurse | True to apply collision type to entity's children |
Entity* xEntityCollided | ( | Entity * | entity, |
int | typeID | ||
) |
Returns true if an entity collided with any other entity of the specified type.
entity | Entity handle |
typeID | Type of entity |
int xCountCollisions | ( | Entity * | entity | ) |
Returns how many collisions an entity was involved in during the last xUpdateWorld()
entity | Entity handle |
float xCollisionX | ( | Entity * | entity, |
int | index | ||
) |
Returns the world x coordinate of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionY | ( | Entity * | entity, |
int | index | ||
) |
Returns the world y coordinate of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionZ | ( | Entity * | entity, |
int | index | ||
) |
Returns the world z coordinate of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionNX | ( | Entity * | entity, |
int | index | ||
) |
Returns the x component of the normal of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionNY | ( | Entity * | entity, |
int | index | ||
) |
Returns the y component of the normal of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionNZ | ( | Entity * | entity, |
int | index | ||
) |
Returns the z component of the normal of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
float xCollisionTime | ( | Entity * | entity, |
int | index | ||
) |
Returns the time taken to calculate a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
Entity* xCollisionEntity | ( | Entity * | entity, |
int | index | ||
) |
Returns the other entity involved in a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
Surface* xCollisionSurface | ( | Entity * | entity, |
int | index | ||
) |
Returns the handle of the surface belonging to the specified entity that was closest to the point of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
int xCollisionTriangle | ( | Entity * | entity, |
int | index | ||
) |
Returns the index number of the triangle belonging to the specified entity that was closest to the point of a particular collision.
Index should be in the range [0; xCountCollisions(entity) - 1]
entity | Entity handle |
index | Index of collision |
void xEntityPickMode | ( | Entity * | entity, |
int | mode, | ||
bool | obscurer = true , |
||
bool | recursive = true |
||
) |
Sets the pick mode for an entity.
entity | Entity handle |
mode | Entity picking mode. See 'Picking types' for more infromation |
obscurer | True to determine that the entity 'obscures' other entities during an xEntityVisible() call. |
recursive | Pick mode will automatically applied to all entity childs |