|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Public Types | Public Member Functions | Static Public Member Functions
gameplay::PhysicsCollisionShape Class Reference

`#include <PhysicsCollisionShape.h>`

Inheritance diagram for gameplay::PhysicsCollisionShape:

List of all members.

## Classes

struct | Definition
struct | HeightfieldData
struct | MeshData

## Public Types

enum | Type { SHAPE_NONE, SHAPE_BOX, SHAPE_SPHERE, SHAPE_CAPSULE, SHAPE_MESH, SHAPE_HEIGHTFIELD }

## Public Member Functions

PhysicsCollisionShape::Type | getType () const
btCollisionShape * | getShape () const

## Static Public Member Functions

static PhysicsCollisionShape::Definition | box ()
static PhysicsCollisionShape::Definition | box (const Vector3 &extents, const Vector3 &center=Vector3::zero(), bool absolute=false)
static PhysicsCollisionShape::Definition | sphere ()
static PhysicsCollisionShape::Definition | sphere (float radius, const Vector3 &center=Vector3::zero(), bool absolute=false)
static PhysicsCollisionShape::Definition | capsule ()
static PhysicsCollisionShape::Definition | capsule (float radius, float height, const Vector3 &center=Vector3::zero(), bool absolute=false)
static PhysicsCollisionShape::Definition | heightfield ()
static PhysicsCollisionShape::Definition | heightfield (HeightField *heightfield)
static PhysicsCollisionShape::Definition | mesh (Mesh *mesh)

## Detailed Description

Defines the physics collision shape class that all supported shapes derive from.

## Member Enumeration Documentation

enum gameplay::PhysicsCollisionShape::Type

Defines the supported collision shape types.

## Member Function Documentation

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::box | ( |  | ) | `[static]`

Defines a box shape, using the bounding volume of the node it is attached to.

Returns:
  Definition of a box shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::box | ( | const Vector3 & | extents,
|  | const Vector3 & | center = `Vector3::zero()`,
|  | bool | absolute = `false`
| ) |  | `[static]`

Defines a box shape, using the specified shape information and center.

Parameters:

  extents | Extents of the box shape along the x, y and z axes.
  center | Center point of the box.
  absolute | True to specify that the given center point is an absolute position. By default the center point is treated as relative to the location of the node that the shape is attached to.

Returns:
  Definition of a box shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::capsule | ( |  | ) | `[static]`

Defines a capsule shape, using the bounding volume of the node it is attached to.

Returns:
  Definition of a capsule shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::capsule | ( | float | radius,
|  | float | height,
|  | const Vector3 & | center = `Vector3::zero()`,
|  | bool | absolute = `false`
| ) |  | `[static]`

Defines a capsule shape, using the specified shape information and center.

Parameters:

  radius | Radius of the capsule.
  height | Height of the capsule.
  center | Center point of the capsule.
  absolute | True to specify that the given center point is an absolute position. By default the center point is treated as relative to the location of the node that the shape is attached to.

Returns:
  Definition of a capsule shape.

btCollisionShape* gameplay::PhysicsCollisionShape::getShape | ( |  | ) | const`[inline]`

Returns the internal bullet physics shape object.

Returns:
  The bullet shape object.

PhysicsCollisionShape::Type gameplay::PhysicsCollisionShape::getType | ( |  | ) | const

Returns the type of this collision shape.

Returns:
  The collision shape type.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::heightfield | ( |  | ) | `[static]`

Defines a heightfield shape, using the height data of a terrain on the node that is attached to.

This method only results in a valid heightfield collision object when the shape is used to create a collision object on a node that has a Terrain attached to it. If there is no Terrain attached to the node, the collision object creation will fail.

Returns:
  Definition of a heightfield shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::heightfield | ( | HeightField * | heightfield | ) | `[static]`

Defines a heightfield shape using the specified array of height values.

The dimensions of the heightfield will be (width, maxHeight, height), where width and height are the dimensions of the passed in height array and maxHeight is the maximum height value in the height array.

Heightfield rigid bodies are always assumed be Y-up (height value on the Y axis) and be centered around the X and Z axes.

The heightfield can be scaled once a PhysicsRigidBody has been created for it, using the PhysicsRigidBody::setLocalScaling method.

Parameters:

  heightfield | HeightField object containing the array of height values representing the heightfield.

Returns:
  Definition of a heightfield shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::mesh | ( | Mesh * | mesh | ) | `[static]`

Defines a mesh shape using the specified mesh.

Returns:
  Definition of a mesh shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::sphere | ( |  | ) | `[static]`

Defines a sphere shape, using the bounding volume of the node it is attached to.

Returns:
  Definition of a sphere shape.

static PhysicsCollisionShape::Definition gameplay::PhysicsCollisionShape::sphere | ( | float | radius,
|  | const Vector3 & | center = `Vector3::zero()`,
|  | bool | absolute = `false`
| ) |  | `[static]`

Defines a sphere shape, using the specified shape information and center.

Parameters:

  radius | Radius of the sphere.
  center | Center point of the sphere.
  absolute | True to specify that the given center point is an absolute position. By default the center point is treated as relative to the location of the node that the shape is attached to.

Returns:
  Definition of a sphere shape.

## Member Data Documentation

HeightfieldData* gameplay::PhysicsCollisionShape::heightfieldData

MeshData* gameplay::PhysicsCollisionShape::meshData

All Classes Functions Variables Typedefs Enumerations Enumerator