CAST II Game Engine

   MAIN       FEATURES       SCREENSHOTS       FORUMS       MANUAL       DOWNLOADS       CONTACTS   
Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Enumerations
Variables
Constants
Functions and Procedures
Identifiers

Unit Collisions

Description

Collisions unit

(C) 2006-2007 George "Mirage" Bakhtadze. www.casteng.com
The source code may be used under either MPL 1.1 or LGPL 2.1 license. See included license.txt file
Unit contains collision detection routines

Functions and Procedures

Overview

function OOBBOOBBColDet (const Transform1, Transform2: Base3D.TMatrix4s; const OOBB1, OOBB2: TBoundingVolume): Boolean;
function OOBBOOBBColDet2D(const Transform1, Transform2: Base3D.TMatrix4s; const OOBB1, OOBB2: TBoundingVolume): Boolean;
function RayCircleColDet(const RayOrigin, RayDir, SphereOrigin: BaseTypes.TVector3s; SphereRadius: Single; var Point: BaseTypes.TVector3s): Boolean;
function RaySphereColDet(const RayOrigin, RayDir, SphereOrigin: BaseTypes.TVector3s; SphereRadius: Single; var Point: BaseTypes.TVector3s): Boolean;
function SphereOOBBColDet(const Transform1, Transform2: Base3D.TMatrix4s; const Sphere, OOBB: TBoundingVolume): Boolean;
function VolumeColDet(Volume1, Volume2: TBoundingVolumes; const Transform1, Transform2: Base3D.TMatrix4s): TCollisionResult;
function VolumeColTest(const Volume1, Volume2: TBoundingVolumes; const Transform1, Transform2: Base3D.TMatrix4s): Boolean;

Description

function OOBBOOBBColDet (const Transform1, Transform2: Base3D.TMatrix4s; const OOBB1, OOBB2: TBoundingVolume): Boolean;

Returns True if the two given OOBBs intersects. Transform1 and Transform2 specifies location and orientation of the volumes within the world space and should not contain scale.

function OOBBOOBBColDet2D(const Transform1, Transform2: Base3D.TMatrix4s; const OOBB1, OOBB2: TBoundingVolume): Boolean;

Returns True if the two given OOBBs intersects in XZ plane. It's faster then OOBBOOBBColDet a little. Transform1 and Transform2 specifies location and orientation of the volumes within the world space and should not contain scale.

function RayCircleColDet(const RayOrigin, RayDir, SphereOrigin: BaseTypes.TVector3s; SphereRadius: Single; var Point: BaseTypes.TVector3s): Boolean;

Returns True if a ray with the specified origin and direction intersects with a sphere with the specified origin and radius. Point is filled with the nearest to ray origin intersection point if any

function RaySphereColDet(const RayOrigin, RayDir, SphereOrigin: BaseTypes.TVector3s; SphereRadius: Single; var Point: BaseTypes.TVector3s): Boolean;

Returns True if a ray with the specified origin and direction intersects with a sphere with the specified origin and radius. Point is filled with the nearest to ray origin intersection point if any

function SphereOOBBColDet(const Transform1, Transform2: Base3D.TMatrix4s; const Sphere, OOBB: TBoundingVolume): Boolean;

Returns True if the given sphere intersects with the given OOBB. Transform1 and Transform2 specifies location and orientation of the volumes within the world space and should not contain scale.

function VolumeColDet(Volume1, Volume2: TBoundingVolumes; const Transform1, Transform2: Base3D.TMatrix4s): TCollisionResult;

Checks two arrays of bounding volumes for collision and returns result in TCollisionResult structure. Transform1 and Transform2 specifies location and orientation of the volume arrays within the world space and should not contain scale.

function VolumeColTest(const Volume1, Volume2: TBoundingVolumes; const Transform1, Transform2: Base3D.TMatrix4s): Boolean;

Returns True if there is an intersection between bounding volumes from the given arrays. Transform1 and Transform2 specifies location and orientation of the volume arrays within the world space and should not contain scale.

Types

Overview

TBoundingVolume = record VolumeKind: TBoundingVolumeKind; Offset, Dimensions: BaseTypes.TVector3s; end;
TBoundingVolumes = array of TBoundingVolume;
TCollisionResult = record Vol1, Vol2: ^TBoundingVolume; end;

Description

TBoundingVolume = record VolumeKind: TBoundingVolumeKind; Offset, Dimensions: BaseTypes.TVector3s; end;

Bounding volume data structure VolumeKind - bvkOOBB - object-oriented bounding box, bvkSphere - sphere Offset - offset of the volume's center Dimensions - half-size of a box or radius of a sphere (in x component)

TBoundingVolumes = array of TBoundingVolume;

Array of bounding volumes

TCollisionResult = record Vol1, Vol2: ^TBoundingVolume; end;

Data structure of a collision-test result. Contains the two collided volumes or nils if no collision detected

Enumerations

TBoundingVolumeKind
Bounding volume kind
 bvkOOBBObject-oriented bounding box
 bvkSphereBounding sphere

Last modified: 26 Oct, 2008
Copyright (C) 2006-2008, casteng.com