physicsCollision.h
Engine/source/T3D/physics/physicsCollision.h
Classes:
class
The shared collision representation for a instance of a static or dynamic physics body.
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_ 25#define _T3D_PHYSICS_PHYSICSCOLLISION_H_ 26 27#ifndef _REFBASE_H_ 28#include "core/util/refBase.h" 29#endif 30 31class Point3F; 32class MatrixF; 33class PlaneF; 34 35 36/// The shared collision representation for a instance of a 37/// static or dynamic physics body. 38/// 39/// Note that making very big convex primitives can cause bad 40/// queries and collisions in some physics providers. 41/// 42/// @see PhysicsBody 43/// 44class PhysicsCollision : public StrongRefBase 45{ 46public: 47 48 /// Add an infinite plane to the collision shape. 49 /// 50 /// This shape is assumed to be static in some physics 51 /// providers and will at times be faked with a large box. 52 /// 53 virtual void addPlane( const PlaneF &plane ) = 0; 54 55 /// Add a box to the collision shape. 56 virtual void addBox( const Point3F &halfWidth, 57 const MatrixF &localXfm ) = 0; 58 59 /// Add a sphere to the collision shape. 60 virtual void addSphere( F32 radius, 61 const MatrixF &localXfm ) = 0; 62 63 /// Add a Y axis capsule to the collision shape. 64 virtual void addCapsule( F32 radius, 65 F32 height, 66 const MatrixF &localXfm ) = 0; 67 68 /// Add a point cloud convex hull to the collision shape. 69 virtual bool addConvex( const Point3F *points, 70 U32 count, 71 const MatrixF &localXfm ) = 0; 72 73 /// Add a triangle mesh to the collision shape. 74 virtual bool addTriangleMesh( const Point3F *vert, 75 U32 vertCount, 76 const U32 *index, 77 U32 triCount, 78 const MatrixF &localXfm ) = 0; 79 80 /// Add a heightfield to the collision shape. 81 virtual bool addHeightfield( const U16 *heights, 82 const bool *holes, 83 U32 blockSize, 84 F32 metersPerSample, 85 const MatrixF &localXfm ) = 0; 86}; 87 88#endif // _T3D_PHYSICS_PHYSICSCOLLISION_H_ 89