declare namespace pc { /** * @component * @name pc.CollisionComponent * @description Create a new CollisionComponent * @class A collision volume. use this in conjunction with a {@link pc.RigidBodyComponent} to make a collision volume that can be simulated using the physics engine. *

If the {@link pc.Entity} does not have a {@link pc.RigidBodyComponent} then this collision volume will act as a trigger volume. When an entity with a dynamic * or kinematic body enters or leaves an entity with a trigger volume, both entities will receive trigger events. *

The following table shows all the events that can be fired between two Entities: * * * * * * * * * * * * * * * * * * * * *
Rigid Body (Static)Rigid Body (Dynamic or Kinematic)Trigger Volume
Rigid Body (Static)-
    *
  • contact
  • *
  • collisionstart
  • *
  • collisionend
  • *
-
Rigid Body (Dynamic or Kinematic)
    *
  • contact
  • *
  • collisionstart
  • *
  • collisionend
  • *
    *
  • contact
  • *
  • collisionstart
  • *
  • collisionend
  • *
    *
  • triggerenter
  • *
  • triggerleave
  • *
Trigger Volume-
    *
  • triggerenter
  • *
  • triggerleave
  • *
-
*

* @param {pc.CollisionComponentSystem} system The ComponentSystem that created this Component * @param {pc.Entity} entity The Entity that this Component is attached to. * @property {String} type The type of the collision volume. Defaults to 'box'. Can be one of the following: * * @property {pc.Vec3} halfExtents The half-extents of the box-shaped collision volume in the x, y and z axes. Defaults to [0.5, 0.5, 0.5] * @property {Number} radius The radius of the sphere, capsule or cylinder-shaped collision volumes. Defaults to 0.5 * @property {Number} axis The local space axis with which the capsule or cylinder-shaped collision volume's length is aligned. 0 for X, 1 for Y and 2 for Z. Defaults to 1 (Y-axis). * @property {Number} height The total height of the capsule or cylinder-shaped collision volume from tip to tip. Defaults to 2. * @property {pc.Asset} asset The asset for the model of the mesh collision volume - can also be an asset id. * @property {pc.Model} model The model that is added to the scene graph for the mesh collision volume. * @extends pc.Component */ class CollisionComponent extends pc.Component { constructor(system: pc.CollisionComponentSystem, entity: pc.Entity) type: string; halfExtents: pc.Vec3; radius: number; axis: number; height: number; asset: pc.Asset; model: pc.Model; } }