diff --git a/docs/classes/AABB.html b/docs/classes/AABB.html index 4c8c7fd5..c80d59cd 100644 --- a/docs/classes/AABB.html +++ b/docs/classes/AABB.html @@ -1,37 +1,37 @@ AABB | cannon-es
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AABB

Axis aligned bounding box class.

-

Hierarchy

  • AABB

Index

Constructors

constructor

  • new AABB(options?: { lowerBound?: Vec3; upperBound?: Vec3 }): AABB

Hierarchy

  • AABB

Index

Constructors

constructor

  • new AABB(options?: { lowerBound?: Vec3; upperBound?: Vec3 }): AABB
  • Parameters

    • options: { lowerBound?: Vec3; upperBound?: Vec3 } = {}
      • Optional lowerBound?: Vec3

        The upper bound of the bounding box

      • Optional upperBound?: Vec3

        The lower bound of the bounding box

        -

    Returns AABB

Properties

lowerBound

lowerBound: Vec3
+

Returns AABB

Properties

lowerBound

lowerBound: Vec3

The lower bound of the bounding box

-

upperBound

upperBound: Vec3
+

upperBound

upperBound: Vec3

The upper bound of the bounding box

-

Methods

clone

Methods

clone

contains

  • contains(aabb: AABB): boolean

contains

  • contains(aabb: AABB): boolean
  • Returns true if the given AABB is fully contained in this AABB.

    -

    Parameters

    Returns boolean

copy

copy

  • Copy bounds from an AABB to this AABB

    Parameters

    • aabb: AABB

      Source to copy from

    Returns AABB

    The this object, for chainability

    -

extend

  • extend(aabb: AABB): void

extend

  • extend(aabb: AABB): void

overlaps

  • overlaps(aabb: AABB): boolean

overlaps

  • overlaps(aabb: AABB): boolean

overlapsRay

  • overlapsRay(ray: Ray): boolean

overlapsRay

  • overlapsRay(ray: Ray): boolean

setFromPoints

setFromPoints

  • Set the AABB bounds from a set of points.

    Parameters

    • points: Vec3[]

      An array of Vec3's.

    • Optional position: Vec3
    • Optional quaternion: Quaternion
    • Optional skinSize: number

    Returns AABB

    The self object

    -

toLocalFrame

toLocalFrame

toWorldFrame

toWorldFrame

\ No newline at end of file diff --git a/docs/classes/ArrayCollisionMatrix.html b/docs/classes/ArrayCollisionMatrix.html index 4975475f..faaa9b1d 100644 --- a/docs/classes/ArrayCollisionMatrix.html +++ b/docs/classes/ArrayCollisionMatrix.html @@ -1,14 +1,14 @@ ArrayCollisionMatrix | cannon-es
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ArrayCollisionMatrix

Collision "matrix". It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step

-

Hierarchy

  • ArrayCollisionMatrix

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

matrix

matrix: number[]
+

Hierarchy

  • ArrayCollisionMatrix

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

matrix

matrix: number[]

The matrix storage.

-

Methods

get

Methods

get

reset

  • reset(): void

reset

  • reset(): void

set

  • set(bi: Body, bj: Body, value: boolean): void

set

  • set(bi: Body, bj: Body, value: boolean): void

setNumObjects

  • setNumObjects(n: number): void

setNumObjects

  • setNumObjects(n: number): void
\ No newline at end of file diff --git a/docs/classes/Body.html b/docs/classes/Body.html index 72b31ec5..6582b1fb 100644 --- a/docs/classes/Body.html +++ b/docs/classes/Body.html @@ -2,7 +2,7 @@

Base class for all body types.

example
const shape = new CANNON.Sphere(1)
const body = new CANNON.Body({
mass: 1,
shape,
})
world.addBody(body)
-

Hierarchy

Index

Constructors

constructor

Hierarchy

Index

Constructors

constructor

  • new Body(options?: { allowSleep?: boolean; angularDamping?: number; angularFactor?: Vec3; angularVelocity?: Vec3; collisionFilterGroup?: number; collisionFilterMask?: number; collisionResponse?: boolean; fixedRotation?: boolean; isTrigger?: boolean; linearDamping?: number; linearFactor?: Vec3; mass?: number; material?: Material; position?: Vec3; quaternion?: Quaternion; shape?: Shape; sleepSpeedLimit?: number; sleepTimeLimit?: number; type?: BodyType; velocity?: Vec3 }): Body
  • Parameters

    • options: { allowSleep?: boolean; angularDamping?: number; angularFactor?: Vec3; angularVelocity?: Vec3; collisionFilterGroup?: number; collisionFilterMask?: number; collisionResponse?: boolean; fixedRotation?: boolean; isTrigger?: boolean; linearDamping?: number; linearFactor?: Vec3; mass?: number; material?: Material; position?: Vec3; quaternion?: Quaternion; shape?: Shape; sleepSpeedLimit?: number; sleepTimeLimit?: number; type?: BodyType; velocity?: Vec3 } = {}
      • Optional allowSleep?: boolean

        If true, the body will automatically fall to sleep.

        default

        true

      • Optional angularDamping?: number
        @@ -53,130 +53,130 @@

        One of: Body.DYNAMIC, Body.STATIC and Body.KINEMATIC.

      • Optional velocity?: Vec3

        World space velocity of the body.

        -

    Returns Body

Events

Static COLLIDE_EVENT_NAME

COLLIDE_EVENT_NAME: string = 'collide'
+

Returns Body

Events

Static COLLIDE_EVENT_NAME

COLLIDE_EVENT_NAME: string = 'collide'

Dispatched after two bodies collide. This event is dispatched on each of the two bodies involved in the collision.

param body

The body that was involved in the collision.

param contact

The details of the collision.

-

Static sleepEvent

sleepEvent: {} = ...
+

Static sleepEvent

sleepEvent: {} = ...

Dispatched after a body has fallen asleep.

-

Type declaration

    Static sleepyEvent

    sleepyEvent: {} = ...
    +

    Type declaration

      Static sleepyEvent

      sleepyEvent: {} = ...

      Dispatched after a body has gone in to the sleepy state.

      -

      Type declaration

        Static wakeupEvent

        wakeupEvent: {} = ...
        +

        Type declaration

          Static wakeupEvent

          wakeupEvent: {} = ...

          Dispatched after a sleeping body has woken up.

          -

          Type declaration

            Properties

            aabb

            aabb: AABB
            +

            Type declaration

              Properties

              aabb

              aabb: AABB

              World space bounding box of the body and its shapes.

              -

              aabbNeedsUpdate

              aabbNeedsUpdate: boolean
              +

              aabbNeedsUpdate

              aabbNeedsUpdate: boolean

              Indicates if the AABB needs to be updated before use.

              -

              allowSleep

              allowSleep: boolean
              +

              allowSleep

              allowSleep: boolean

              If true, the body will automatically fall to sleep.

              default

              true

              -

              angularDamping

              angularDamping: number
              +

              angularDamping

              angularDamping: number

              How much to damp the body angular velocity each step. It can go from 0 to 1.

              default

              0.01

              -

              angularFactor

              angularFactor: Vec3
              +

              angularFactor

              angularFactor: Vec3

              Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.

              -

              angularVelocity

              angularVelocity: Vec3
              +

              angularVelocity

              angularVelocity: Vec3

              Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.

              -

              boundingRadius

              boundingRadius: number
              +

              boundingRadius

              boundingRadius: number

              Total bounding radius of the Body including its shapes, relative to body.position.

              -

              collisionFilterGroup

              collisionFilterGroup: number
              +

              collisionFilterGroup

              collisionFilterGroup: number

              The collision group the body belongs to.

              default

              1

              -

              collisionFilterMask

              collisionFilterMask: number
              +

              collisionFilterMask

              collisionFilterMask: number

              The collision group the body can collide with.

              default

              -1

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered.

              -

              fixedRotation

              fixedRotation: boolean
              +

              fixedRotation

              fixedRotation: boolean

              Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation.

              default

              false

              -

              force

              force: Vec3
              +

              force

              force: Vec3

              Linear force on the body in world space.

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the body.

              -

              index

              index: number
              +

              index

              index: number

              Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix.

              -

              inertia

              inertia: Vec3
              +

              inertia

              inertia: Vec3

              The inertia of the body.

              -

              initAngularVelocity

              initAngularVelocity: Vec3
              +

              initAngularVelocity

              initAngularVelocity: Vec3

              Initial angular velocity of the body.

              -

              initPosition

              initPosition: Vec3
              +

              initPosition

              initPosition: Vec3

              Initial position of the body.

              -

              initQuaternion

              initQuaternion: Quaternion
              +

              initQuaternion

              initQuaternion: Quaternion

              Initial quaternion of the body.

              -

              initVelocity

              initVelocity: Vec3
              +

              initVelocity

              initVelocity: Vec3

              Initial velocity of the body.

              -

              interpolatedPosition

              interpolatedPosition: Vec3
              +

              interpolatedPosition

              interpolatedPosition: Vec3

              Interpolated position of the body.

              -

              interpolatedQuaternion

              interpolatedQuaternion: Quaternion
              +

              interpolatedQuaternion

              interpolatedQuaternion: Quaternion

              Interpolated orientation of the body.

              -

              isTrigger

              isTrigger: boolean
              +

              isTrigger

              isTrigger: boolean

              When true the body behaves like a trigger. It does not collide with other bodies but collision events are still triggered.

              default

              false

              -

              linearDamping

              linearDamping: number
              +

              linearDamping

              linearDamping: number

              How much to damp the body velocity each step. It can go from 0 to 1.

              default

              0.01

              -

              linearFactor

              linearFactor: Vec3
              +

              linearFactor

              linearFactor: Vec3

              Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.

              -

              mass

              mass: number
              +

              mass

              mass: number

              The mass of the body.

              default

              0

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              The physics material of the body. It defines the body interaction with other bodies.

              -

              position

              position: Vec3
              +

              position

              position: Vec3

              World space position of the body.

              -

              quaternion

              quaternion: Quaternion
              +

              quaternion

              quaternion: Quaternion

              World space orientation of the body.

              -

              shapeOffsets

              shapeOffsets: Vec3[]
              +

              shapeOffsets

              shapeOffsets: Vec3[]

              Position of each Shape in the body, given in local Body space.

              -

              shapeOrientations

              shapeOrientations: Quaternion[]
              +

              shapeOrientations

              shapeOrientations: Quaternion[]

              Orientation of each Shape, given in local Body space.

              -

              shapes

              shapes: Shape[]
              +

              shapes

              shapes: Shape[]

              List of Shapes that have been added to the body.

              -

              sleepSpeedLimit

              sleepSpeedLimit: number
              +

              sleepSpeedLimit

              sleepSpeedLimit: number

              If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.

              default

              0.1

              -

              sleepState

              sleepState: BodySleepState
              +

              sleepState

              sleepState: BodySleepState

              Current sleep state.

              -

              sleepTimeLimit

              sleepTimeLimit: number
              +

              sleepTimeLimit

              sleepTimeLimit: number

              If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.

              default

              1

              -

              torque

              torque: Vec3
              +

              torque

              torque: Vec3

              World space rotational force on the body, around center of mass.

              -

              type

              type: BodyType
              +

              type

              type: BodyType

              One of: Body.DYNAMIC, Body.STATIC and Body.KINEMATIC.

              -

              velocity

              velocity: Vec3
              +

              velocity

              velocity: Vec3

              World space velocity of the body.

              -

              world

              world: null | World
              +

              world

              world: null | World

              Reference to the world the body is living in.

              -

              Static AWAKE

              AWAKE: 0 = BODY_SLEEP_STATES.AWAKE
              +

              Static AWAKE

              AWAKE: 0 = BODY_SLEEP_STATES.AWAKE

              AWAKE

              -

              Static DYNAMIC

              DYNAMIC: 1 = BODY_TYPES.DYNAMIC
              +

              Static DYNAMIC

              DYNAMIC: 1 = BODY_TYPES.DYNAMIC

              A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.

              -

              Static KINEMATIC

              KINEMATIC: 4 = BODY_TYPES.KINEMATIC
              +

              Static KINEMATIC

              KINEMATIC: 4 = BODY_TYPES.KINEMATIC

              A kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies.

              -

              Static SLEEPING

              SLEEPING: 2 = BODY_SLEEP_STATES.SLEEPING
              +

              Static SLEEPING

              SLEEPING: 2 = BODY_SLEEP_STATES.SLEEPING

              SLEEPING

              -

              Static SLEEPY

              SLEEPY: 1 = BODY_SLEEP_STATES.SLEEPY
              +

              Static SLEEPY

              SLEEPY: 1 = BODY_SLEEP_STATES.SLEEPY

              SLEEPY

              -

              Static STATIC

              STATIC: 2 = BODY_TYPES.STATIC
              +

              Static STATIC

              STATIC: 2 = BODY_TYPES.STATIC

              A static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies.

              -

              Methods

              addEventListener

              • addEventListener(type: string, listener: Function): EventTarget

              Methods

              addEventListener

              • addEventListener(type: string, listener: Function): EventTarget

              addShape

              addShape

              • Add a shape to the body with a local offset and orientation.

                Parameters

                Returns Body

                The body object, for chainability.

                -

              applyForce

              • applyForce(force: Vec3, relativePoint?: Vec3): void

              applyForce

              • applyForce(force: Vec3, relativePoint?: Vec3): void
              • Apply force to a point of the body. This could for example be a point on the Body surface. Applying force this way will add to Body.force and Body.torque.

                Parameters

                • force: Vec3

                  The amount of force to add.

                • relativePoint: Vec3 = ...

                  A point relative to the center of mass to apply the force on.

                  -

                Returns void

              applyImpulse

              • applyImpulse(impulse: Vec3, relativePoint?: Vec3): void

              Returns void

              applyImpulse

              • applyImpulse(impulse: Vec3, relativePoint?: Vec3): void
              • Apply impulse to a point of the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.

                @@ -184,29 +184,29 @@

                The amount of impulse to add.

              • relativePoint: Vec3 = ...

                A point relative to the center of mass to apply the force on.

                -

              Returns void

              applyLocalForce

              • applyLocalForce(localForce: Vec3, localPoint?: Vec3): void

              Returns void

              applyLocalForce

              • applyLocalForce(localForce: Vec3, localPoint?: Vec3): void
              • Apply force to a local point in the body.

                Parameters

                • localForce: Vec3
                • localPoint: Vec3 = ...

                  A local point in the body to apply the force on.

                  -

                Returns void

              applyLocalImpulse

              • applyLocalImpulse(localImpulse: Vec3, localPoint?: Vec3): void

              Returns void

              applyLocalImpulse

              • applyLocalImpulse(localImpulse: Vec3, localPoint?: Vec3): void
              • Apply locally-defined impulse to a local point in the body.

                Parameters

                • localImpulse: Vec3
                • localPoint: Vec3 = ...

                  A local point in the body to apply the force on.

                  -

                Returns void

              applyTorque

              • applyTorque(torque: Vec3): void

              Returns void

              applyTorque

              • applyTorque(torque: Vec3): void
              • Apply torque to the body.

                Parameters

                • torque: Vec3

                  The amount of torque to add.

                  -

                Returns void

              dispatchEvent

              Returns void

              dispatchEvent

              getVelocityAtWorldPoint

              • getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3

              getVelocityAtWorldPoint

              • getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3

              hasAnyEventListener

              • hasAnyEventListener(type: string): boolean

              hasAnyEventListener

              • hasAnyEventListener(type: string): boolean

              hasEventListener

              • hasEventListener(type: string, listener: Function): boolean

              hasEventListener

              • hasEventListener(type: string, listener: Function): boolean

              integrate

              • integrate(dt: number, quatNormalize: boolean, quatNormalizeFast: boolean): void

              integrate

              • integrate(dt: number, quatNormalize: boolean, quatNormalizeFast: boolean): void
              • Move the body forward in time.

                Parameters

                • dt: number

                  Time step

                  @@ -214,36 +214,36 @@

                  Set to true to normalize the body quaternion

                • quatNormalizeFast: boolean

                  If the quaternion should be normalized using "fast" quaternion normalization

                  -

                Returns void

              pointToLocalFrame

              Returns void

              pointToLocalFrame

              pointToWorldFrame

              pointToWorldFrame

              removeEventListener

              • removeEventListener(type: string, listener: Function): EventTarget

              removeEventListener

              • removeEventListener(type: string, listener: Function): EventTarget

              removeShape

              removeShape

              sleep

              • sleep(): void

              sleep

              • sleep(): void

              sleepTick

              • sleepTick(time: number): void

              sleepTick

              • sleepTick(time: number): void
              • Called every timestep to update internal sleep timer and change sleep state if needed.

                Parameters

                • time: number

                  The world time in seconds

                  -

                Returns void

              updateAABB

              • updateAABB(): void

              Returns void

              updateAABB

              • updateAABB(): void

              updateBoundingRadius

              • updateBoundingRadius(): void

              updateBoundingRadius

              • updateBoundingRadius(): void
              • Update the bounding radius of the body. Should be done if any of the shapes are changed.

                -

                Returns void

              updateInertiaWorld

              • updateInertiaWorld(force?: boolean): void

              updateInertiaWorld

              • updateInertiaWorld(force?: boolean): void
              • Update .inertiaWorld and .invInertiaWorld

                -

                Parameters

                • Optional force: boolean

                Returns void

              updateMassProperties

              • updateMassProperties(): void

              updateMassProperties

              • updateMassProperties(): void
              • Should be called whenever you change the body shape or mass.

                -

                Returns void

              updateSolveMassProperties

              • updateSolveMassProperties(): void

              updateSolveMassProperties

              • updateSolveMassProperties(): void
              • If the body is sleeping, it should be immovable / have infinite mass during solve. We solve it by having a separate "solve mass".

                -

                Returns void

              vectorToLocalFrame

              vectorToLocalFrame

              vectorToWorldFrame

              vectorToWorldFrame

              wakeUp

              • wakeUp(): void

              wakeUp

              • wakeUp(): void
              \ No newline at end of file diff --git a/docs/classes/Box.html b/docs/classes/Box.html index 9a0b4f6f..53dd799a 100644 --- a/docs/classes/Box.html +++ b/docs/classes/Box.html @@ -2,41 +2,41 @@

              A 3d box shape.

              example
              const size = 1
              const halfExtents = new CANNON.Vec3(size, size, size)
              const boxShape = new CANNON.Box(halfExtents)
              const boxBody = new CANNON.Body({ mass: 1, shape: boxShape })
              world.addBody(boxBody)
              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              convexPolyhedronRepresentation

              convexPolyhedronRepresentation: ConvexPolyhedron
              +

              convexPolyhedronRepresentation

              convexPolyhedronRepresentation: ConvexPolyhedron

              Used by the contact generator to make contacts with other convex polyhedra for example.

              -

              halfExtents

              halfExtents: Vec3
              +

              halfExtents

              halfExtents: Vec3

              The half extents of the box.

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              calculateWorldAABB

              calculateWorldAABB

              forEachWorldCorner

              • forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: (x: number, y: number, z: number) => void): void

              forEachWorldCorner

              • forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: (x: number, y: number, z: number) => void): void
              • forEachWorldCorner

                -

                Parameters

                • pos: Vec3
                • quat: Quaternion
                • callback: (x: number, y: number, z: number) => void
                    • (x: number, y: number, z: number): void
                    • Parameters

                      • x: number
                      • y: number
                      • z: number

                      Returns void

                Returns void

              getSideNormals

              • +

                Parameters

                • pos: Vec3
                • quat: Quaternion
                • callback: (x: number, y: number, z: number) => void
                    • (x: number, y: number, z: number): void
                    • Parameters

                      • x: number
                      • y: number
                      • z: number

                      Returns void

                Returns void

              getSideNormals

              • Get the box 6 side normals

                Parameters

                • sixTargetVectors: Vec3[]

                  An array of 6 vectors, to store the resulting side normals in.

                • quat: Quaternion

                  Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.

                  -

                Returns Vec3[]

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              Returns Vec3[]

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateConvexPolyhedronRepresentation

              • updateConvexPolyhedronRepresentation(): void

              updateConvexPolyhedronRepresentation

              • updateConvexPolyhedronRepresentation(): void
              • Updates the local convex polyhedron representation used for some collisions.

                -

                Returns void

              volume

              • volume(): number

              volume

              • volume(): number
              \ No newline at end of file diff --git a/docs/classes/Broadphase.html b/docs/classes/Broadphase.html index a01db567..b3a3ef51 100644 --- a/docs/classes/Broadphase.html +++ b/docs/classes/Broadphase.html @@ -1,15 +1,15 @@ Broadphase | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Broadphase

              Base class for broadphase implementations

              author

              schteppe

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              dirty

              dirty: boolean
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              dirty

              dirty: boolean

              Set to true if the objects in the world moved.

              -

              useBoundingBoxes

              useBoundingBoxes: boolean
              +

              useBoundingBoxes

              useBoundingBoxes: boolean

              If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.

              -

              world

              world: null | World
              +

              world

              world: null | World

              The world to search for collisions in.

              -

              Methods

              aabbQuery

              Methods

              aabbQuery

              collisionPairs

              collisionPairs

              • Get the collision pairs from the world

                Parameters

                • world: World

                  The world to search in

                  @@ -17,22 +17,22 @@

                  Empty array to be filled with body objects

                • p2: Body[]

                  Empty array to be filled with body objects

                  -

                Returns void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              Returns void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void
              • Check if the bounding spheres of two bodies are intersecting.

                Parameters

                • bodyA: Body
                • bodyB: Body
                • pairs1: Body[]

                  bodyA is appended to this array if intersection

                • pairs2: Body[]

                  bodyB is appended to this array if intersection

                  -

                Returns void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              Returns void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              setWorld

              • setWorld(world: World): void

              setWorld

              • setWorld(world: World): void

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean
              \ No newline at end of file diff --git a/docs/classes/ConeTwistConstraint.html b/docs/classes/ConeTwistConstraint.html index 29262214..27f72f0d 100644 --- a/docs/classes/ConeTwistConstraint.html +++ b/docs/classes/ConeTwistConstraint.html @@ -1,6 +1,6 @@ ConeTwistConstraint | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class ConeTwistConstraint

              A Cone Twist constraint, useful for ragdolls.

              -

              Hierarchy

              Index

              Constructors

              constructor

              • new ConeTwistConstraint(bodyA: Body, bodyB: Body, options?: { angle?: number; axisA?: Vec3; axisB?: Vec3; collideConnected?: boolean; maxForce?: number; pivotA?: Vec3; pivotB?: Vec3; twistAngle?: number }): ConeTwistConstraint

              Hierarchy

              Index

              Constructors

              constructor

              • new ConeTwistConstraint(bodyA: Body, bodyB: Body, options?: { angle?: number; axisA?: Vec3; axisB?: Vec3; collideConnected?: boolean; maxForce?: number; pivotA?: Vec3; pivotB?: Vec3; twistAngle?: number }): ConeTwistConstraint

              Properties

              angle

              angle: number

              Properties

              angle

              angle: number

              The aperture angle of the cone.

              -

              axisA

              axisA: Vec3
              +

              axisA

              axisA: Vec3

              The axis direction for the constraint of the body A.

              -

              axisB

              axisB: Vec3
              +

              axisB

              axisB: Vec3

              The axis direction for the constraint of the body B.

              -

              bodyA

              bodyA: Body
              +

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              pivotA

              pivotA: Vec3
              +

              pivotA

              pivotA: Vec3

              Pivot, defined locally in bodyA.

              -

              pivotB

              pivotB: Vec3
              +

              pivotB

              pivotB: Vec3

              Pivot, defined locally in bodyB.

              -

              twistAngle

              twistAngle: number
              +

              twistAngle

              twistAngle: number

              The twist angle of the joint.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              enable

              • enable(): void

              enable

              • enable(): void

              update

              • update(): void

              update

              • update(): void
              \ No newline at end of file diff --git a/docs/classes/Constraint.html b/docs/classes/Constraint.html index d7c0556b..97edc570 100644 --- a/docs/classes/Constraint.html +++ b/docs/classes/Constraint.html @@ -1,23 +1,23 @@ Constraint | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Constraint

              Constraint base class

              -

              Hierarchy

              Index

              Constructors

              constructor

              • new Constraint(bodyA: Body, bodyB: Body, options?: { collideConnected?: boolean; wakeUpBodies?: boolean }): Constraint

              Hierarchy

              Index

              Constructors

              constructor

              • new Constraint(bodyA: Body, bodyB: Body, options?: { collideConnected?: boolean; wakeUpBodies?: boolean }): Constraint
              • Parameters

                • bodyA: Body
                • bodyB: Body
                • options: { collideConnected?: boolean; wakeUpBodies?: boolean } = {}
                  • Optional collideConnected?: boolean

                    Set to false if you don't want the bodies to collide when they are connected.

                    default

                    true

                  • Optional wakeUpBodies?: boolean

                    Set to false if you don't want the bodies to wake up when they are connected.

                    default

                    true

                    -

                Returns Constraint

              Properties

              bodyA

              bodyA: Body
              +

              Returns Constraint

              Properties

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              enable

              • enable(): void

              enable

              • enable(): void

              update

              • update(): void

              update

              • update(): void
              \ No newline at end of file diff --git a/docs/classes/ContactEquation.html b/docs/classes/ContactEquation.html index 1f7c611c..b395d4e1 100644 --- a/docs/classes/ContactEquation.html +++ b/docs/classes/ContactEquation.html @@ -1,44 +1,44 @@ ContactEquation | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class ContactEquation

              Contact/non-penetration constraint equation

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              a

              a: number
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              a

              a: number

              SPOOK parameter

              -

              b

              b: number
              +

              b

              b: number

              SPOOK parameter

              -

              eps

              eps: number
              +

              eps

              eps: number

              SPOOK parameter

              -

              maxForce

              maxForce: number
              +

              maxForce

              maxForce: number

              Maximum (read: positive max) force to be applied by the constraint.

              -

              minForce

              minForce: number
              +

              minForce

              minForce: number

              Minimum (read: negative max) force to be applied by the constraint.

              -

              multiplier

              multiplier: number
              +

              multiplier

              multiplier: number

              A number, proportional to the force added to the bodies.

              -

              ni

              ni: Vec3
              +

              ni

              ni: Vec3

              Contact normal, pointing out of body i.

              -

              restitution

              restitution: number
              +

              restitution

              restitution: number

              "bounciness": u1 = -e*u0

              -

              ri

              ri: Vec3
              +

              ri

              ri: Vec3

              World-oriented vector that goes from the center of bi to the contact point.

              -

              rj

              rj: Vec3
              +

              rj

              rj: Vec3

              World-oriented vector that starts in body j position and goes to the contact point.

              -

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              computeB

              • computeB(h: number): number

              computeB

              • computeB(h: number): number

              computeC

              • computeC(): number

              computeC

              • computeC(): number

              computeGW

              • computeGW(): number

              computeGW

              • computeGW(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMf

              • computeGiMf(): number

              computeGiMf

              • computeGiMf(): number

              computeGq

              • computeGq(): number

              computeGq

              • computeGq(): number

              getImpactVelocityAlongNormal

              • getImpactVelocityAlongNormal(): number

              getImpactVelocityAlongNormal

              • getImpactVelocityAlongNormal(): number

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              Returns ContactMaterial

              Properties

              contactEquationRelaxation

              contactEquationRelaxation: number

              Relaxation time of the produced contact equations.

              default

              3

              -

              contactEquationStiffness

              contactEquationStiffness: number
              +

              contactEquationStiffness

              contactEquationStiffness: number

              Stiffness of the produced contact equations.

              default

              1e7

              -

              friction

              friction: number
              +

              friction

              friction: number

              Friction coefficient.

              default

              0.3

              -

              frictionEquationRelaxation

              frictionEquationRelaxation: number
              +

              frictionEquationRelaxation

              frictionEquationRelaxation: number

              Relaxation time of the produced friction equations

              default

              3

              -

              frictionEquationStiffness

              frictionEquationStiffness: number
              +

              frictionEquationStiffness

              frictionEquationStiffness: number

              Stiffness of the produced friction equations.

              default

              1e7

              -

              id

              id: number
              +

              id

              id: number

              Identifier of this material.

              -

              materials

              materials: [Material, Material]
              +

              materials

              materials: [Material, Material]

              Participating materials.

              -

              restitution

              restitution: number
              +

              restitution

              restitution: number

              Restitution coefficient.

              default

              0.3

              \ No newline at end of file diff --git a/docs/classes/ConvexPolyhedron.html b/docs/classes/ConvexPolyhedron.html index b3e23636..ae55dd57 100644 --- a/docs/classes/ConvexPolyhedron.html +++ b/docs/classes/ConvexPolyhedron.html @@ -9,7 +9,7 @@
              todo

              Automatically merge coplanar polygons in constructor.

              example
              const convexShape = new CANNON.ConvexPolyhedron({ vertices, faces })
              const convexBody = new CANNON.Body({ mass: 1, shape: convexShape })
              world.addBody(convexBody)
              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              • new ConvexPolyhedron(props?: { axes?: Vec3[]; boundingSphereRadius?: number; faces?: number[][]; normals?: Vec3[]; vertices?: Vec3[] }): ConvexPolyhedron

              Properties

              body

              body: null | Body
              +

              Returns ConvexPolyhedron

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              faceNormals

              faceNormals: Vec3[]
              +

              faceNormals

              faceNormals: Vec3[]

              faceNormals

              -

              faces

              faces: number[][]
              +

              faces

              faces: number[][]

              Array of integer arrays, indicating which vertices each face consists of

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              uniqueAxes

              uniqueAxes: null | Vec3[]
              +

              uniqueAxes

              uniqueAxes: null | Vec3[]

              If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.

              -

              uniqueEdges

              uniqueEdges: Vec3[]
              +

              uniqueEdges

              uniqueEdges: Vec3[]

              uniqueEdges

              -

              vertices

              vertices: Vec3[]
              +

              vertices

              vertices: Vec3[]

              vertices

              -

              worldFaceNormals

              worldFaceNormals: Vec3[]
              +

              worldFaceNormals

              worldFaceNormals: Vec3[]

              worldFaceNormals

              -

              worldFaceNormalsNeedsUpdate

              worldFaceNormalsNeedsUpdate: boolean
              +

              worldFaceNormalsNeedsUpdate

              worldFaceNormalsNeedsUpdate: boolean

              worldFaceNormalsNeedsUpdate

              -

              worldVertices

              worldVertices: Vec3[]
              +

              worldVertices

              worldVertices: Vec3[]

              worldVertices

              -

              worldVerticesNeedsUpdate

              worldVerticesNeedsUpdate: boolean
              +

              worldVerticesNeedsUpdate

              worldVerticesNeedsUpdate: boolean

              worldVerticesNeedsUpdate

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void

              calculateWorldAABB

              calculateWorldAABB

              clipFaceAgainstHull

              clipFaceAgainstHull

              clipFaceAgainstPlane

              • clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3[]

              Returns void

              clipFaceAgainstPlane

              • clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3[]
              • Clip a face in a hull against the back of a plane.

                Parameters

                • inVertices: Vec3[]
                • outVertices: Vec3[]
                • planeNormal: Vec3
                • planeConstant: number

                  The constant in the mathematical plane equation

                  -

                Returns Vec3[]

              computeEdges

              • computeEdges(): void

              Returns Vec3[]

              computeEdges

              • computeEdges(): void

              computeNormals

              • computeNormals(): void

              computeNormals

              • computeNormals(): void
              • Compute the normals of the faces. Will reuse existing Vec3 objects in the faceNormals array if they exist.

                -

                Returns void

              computeWorldFaceNormals

              computeWorldFaceNormals

              computeWorldVertices

              computeWorldVertices

              findSeparatingAxis

              findSeparatingAxis

              getAveragePointLocal

              • getAveragePointLocal(target?: Vec3): Vec3

              getAveragePointLocal

              • getAveragePointLocal(target?: Vec3): Vec3

              getFaceNormal

              • getFaceNormal(i: number, target: Vec3): void

              getFaceNormal

              • getFaceNormal(i: number, target: Vec3): void

              pointIsInside

              • pointIsInside(p: Vec3): false | 1 | -1

              pointIsInside

              • pointIsInside(p: Vec3): false | 1 | -1
              • Checks whether p is inside the polyhedra. Must be in local coords. The point lies outside of the convex hull of the other points if and only if the direction of all the vectors from it to those other points are on less than one half of a sphere around it.

                Parameters

                • p: Vec3

                  A point given in local coordinates

                  -

                Returns false | 1 | -1

              testSepAxis

              Returns false | 1 | -1

              testSepAxis

              transformAllPoints

              transformAllPoints

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Static computeNormal

              Static computeNormal

              Static project

              Static project

              • Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis. Results are saved in the array maxmin.

                Parameters

                • shape: ConvexPolyhedron
                • axis: Vec3
                • pos: Vec3
                • quat: Quaternion
                • result: number[]
                  diff --git a/docs/classes/Cylinder.html b/docs/classes/Cylinder.html index eebac348..8a7432a1 100644 --- a/docs/classes/Cylinder.html +++ b/docs/classes/Cylinder.html @@ -2,7 +2,7 @@

                  Cylinder class.

                  example
                  const radiusTop = 0.5
                  const radiusBottom = 0.5
                  const height = 2
                  const numSegments = 12
                  const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments)
                  const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape })
                  world.addBody(cylinderBody)
                  -

              Hierarchy

              Index

              Constructors

              constructor

              • new Cylinder(radiusTop?: number, radiusBottom?: number, height?: number, numSegments?: number): Cylinder

              Hierarchy

              Index

              Constructors

              constructor

              • new Cylinder(radiusTop?: number, radiusBottom?: number, height?: number, numSegments?: number): Cylinder
              • Parameters

                • radiusTop: number = 1

                  The radius of the top of the Cylinder.

                • radiusBottom: number = 1

                  The radius of the bottom of the Cylinder.

                  @@ -10,97 +10,97 @@

                  The height of the Cylinder.

                • numSegments: number = 8

                  The number of segments to build the cylinder out of.

                  -

                Returns Cylinder

              Properties

              body

              body: null | Body
              +

              Returns Cylinder

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              faceNormals

              faceNormals: Vec3[]
              +

              faceNormals

              faceNormals: Vec3[]

              faceNormals

              -

              faces

              faces: number[][]
              +

              faces

              faces: number[][]

              Array of integer arrays, indicating which vertices each face consists of

              -

              height

              height: number
              +

              height

              height: number

              The height of the Cylinder.

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              numSegments

              numSegments: number
              +

              numSegments

              numSegments: number

              The number of segments to build the cylinder out of.

              -

              radiusBottom

              radiusBottom: number
              +

              radiusBottom

              radiusBottom: number

              The radius of the bottom of the Cylinder.

              -

              radiusTop

              radiusTop: number
              +

              radiusTop

              radiusTop: number

              The radius of the top of the Cylinder.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              uniqueAxes

              uniqueAxes: null | Vec3[]
              +

              uniqueAxes

              uniqueAxes: null | Vec3[]

              If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.

              -

              uniqueEdges

              uniqueEdges: Vec3[]
              +

              uniqueEdges

              uniqueEdges: Vec3[]

              uniqueEdges

              -

              vertices

              vertices: Vec3[]
              +

              vertices

              vertices: Vec3[]

              vertices

              -

              worldFaceNormals

              worldFaceNormals: Vec3[]
              +

              worldFaceNormals

              worldFaceNormals: Vec3[]

              worldFaceNormals

              -

              worldFaceNormalsNeedsUpdate

              worldFaceNormalsNeedsUpdate: boolean
              +

              worldFaceNormalsNeedsUpdate

              worldFaceNormalsNeedsUpdate: boolean

              worldFaceNormalsNeedsUpdate

              -

              worldVertices

              worldVertices: Vec3[]
              +

              worldVertices

              worldVertices: Vec3[]

              worldVertices

              -

              worldVerticesNeedsUpdate

              worldVerticesNeedsUpdate: boolean
              +

              worldVerticesNeedsUpdate

              worldVerticesNeedsUpdate: boolean

              worldVerticesNeedsUpdate

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void

              calculateWorldAABB

              calculateWorldAABB

              clipFaceAgainstHull

              clipFaceAgainstHull

              clipFaceAgainstPlane

              • clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3[]

              Returns void

              clipFaceAgainstPlane

              • clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3[]

              computeEdges

              • computeEdges(): void

              Returns Vec3[]

              computeEdges

              • computeEdges(): void

              computeNormals

              • computeNormals(): void

              computeNormals

              • computeNormals(): void

              computeWorldFaceNormals

              computeWorldFaceNormals

              computeWorldVertices

              computeWorldVertices

              findSeparatingAxis

              findSeparatingAxis

              getAveragePointLocal

              • getAveragePointLocal(target?: Vec3): Vec3

              getAveragePointLocal

              • getAveragePointLocal(target?: Vec3): Vec3

              getFaceNormal

              • getFaceNormal(i: number, target: Vec3): void

              getFaceNormal

              • getFaceNormal(i: number, target: Vec3): void

              pointIsInside

              • pointIsInside(p: Vec3): false | 1 | -1

              pointIsInside

              • pointIsInside(p: Vec3): false | 1 | -1
              • Checks whether p is inside the polyhedra. Must be in local coords. The point lies outside of the convex hull of the other points if and only if the direction of all the vectors from it to those other points are on less than one half of a sphere around it.

                Parameters

                • p: Vec3

                  A point given in local coordinates

                  -

                Returns false | 1 | -1

              testSepAxis

              Returns false | 1 | -1

              testSepAxis

              transformAllPoints

              transformAllPoints

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Static computeNormal

              Static computeNormal

              Static project

              Static project

              Properties

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              distance

              distance: number
              +

              distance

              distance: number

              The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              enable

              • enable(): void

              enable

              • enable(): void

              update

              • update(): void

              update

              • update(): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Equation.html b/docs/classes/Equation.html index bfb1d937..a94fa565 100644 --- a/docs/classes/Equation.html +++ b/docs/classes/Equation.html @@ -1,35 +1,35 @@ Equation | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Equation

              Equation base class.

              a, b and eps are SPOOK parameters that default to 0.0. See this exchange for more details on Cannon's physics implementation.

              -

              Hierarchy

              Index

              Constructors

              constructor

              • new Equation(bi: Body, bj: Body, minForce?: number, maxForce?: number): Equation

              Properties

              a

              a: number
              +

              Hierarchy

              Index

              Constructors

              constructor

              • new Equation(bi: Body, bj: Body, minForce?: number, maxForce?: number): Equation

              Properties

              a

              a: number

              SPOOK parameter

              -

              b

              b: number
              +

              b

              b: number

              SPOOK parameter

              -

              eps

              eps: number
              +

              eps

              eps: number

              SPOOK parameter

              -

              maxForce

              maxForce: number
              +

              maxForce

              maxForce: number

              Maximum (read: positive max) force to be applied by the constraint.

              -

              minForce

              minForce: number
              +

              minForce

              minForce: number

              Minimum (read: negative max) force to be applied by the constraint.

              -

              multiplier

              multiplier: number
              +

              multiplier

              multiplier: number

              A number, proportional to the force added to the bodies.

              -

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              computeB

              • computeB(a: number, b: number, h: number): number

              computeB

              • computeB(a: number, b: number, h: number): number
              • Computes the right hand side of the SPOOK equation

                -

                Parameters

                • a: number
                • b: number
                • h: number

                Returns number

              computeC

              • computeC(): number

              computeC

              • computeC(): number
              • Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps

                -

                Returns number

              computeGW

              • computeGW(): number

              computeGW

              • computeGW(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMf

              • computeGiMf(): number

              computeGiMf

              • computeGiMf(): number
              • Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.

                -

                Returns number

              computeGq

              • computeGq(): number

              computeGq

              • computeGq(): number

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              Properties

              a

              a: number

              SPOOK parameter

              -

              b

              b: number
              +

              b

              b: number

              SPOOK parameter

              -

              eps

              eps: number
              +

              eps

              eps: number

              SPOOK parameter

              -

              maxForce

              maxForce: number
              +

              maxForce

              maxForce: number

              Maximum (read: positive max) force to be applied by the constraint.

              -

              minForce

              minForce: number
              +

              minForce

              minForce: number

              Minimum (read: negative max) force to be applied by the constraint.

              -

              multiplier

              multiplier: number
              +

              multiplier

              multiplier: number

              A number, proportional to the force added to the bodies.

              -

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              computeB

              • computeB(h: number): number

              computeB

              • computeB(h: number): number

              computeC

              • computeC(): number

              computeC

              • computeC(): number

              computeGW

              • computeGW(): number

              computeGW

              • computeGW(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMf

              • computeGiMf(): number

              computeGiMf

              • computeGiMf(): number

              computeGq

              • computeGq(): number

              computeGq

              • computeGq(): number

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]

              All equations to be solved

              -

              iterations

              iterations: number
              +

              iterations

              iterations: number

              The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.

              -

              tolerance

              tolerance: number
              +

              tolerance

              tolerance: number

              When tolerance is reached, the system is assumed to be converged.

              -

              Methods

              addEquation

              Methods

              addEquation

              removeAllEquations

              • removeAllEquations(): void

              removeAllEquations

              • removeAllEquations(): void

              removeEquation

              removeEquation

              solve

              • solve(dt: number, world: World): number

              solve

              • solve(dt: number, world: World): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/GridBroadphase.html b/docs/classes/GridBroadphase.html index 6b4ccd5e..fd9718dc 100644 --- a/docs/classes/GridBroadphase.html +++ b/docs/classes/GridBroadphase.html @@ -1,52 +1,52 @@ GridBroadphase | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class GridBroadphase

              Axis aligned uniform grid broadphase.

              todo

              Needs support for more than just planes and spheres.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              aabbMax

              aabbMax: Vec3
              +

              Returns GridBroadphase

              Properties

              aabbMax

              aabbMax: Vec3

              aabbMax

              -

              aabbMin

              aabbMin: Vec3
              +

              aabbMin

              aabbMin: Vec3

              aabbMin

              -

              binLengths

              binLengths: number[]
              +

              binLengths

              binLengths: number[]

              binLengths

              -

              bins

              bins: Body[][]
              +

              bins

              bins: Body[][]

              bins

              -

              dirty

              dirty: boolean
              +

              dirty

              dirty: boolean

              Set to true if the objects in the world moved.

              -

              nx

              nx: number
              +

              nx

              nx: number

              Number of boxes along x

              -

              ny

              ny: number
              +

              ny

              ny: number

              Number of boxes along y

              -

              nz

              nz: number
              +

              nz

              nz: number

              Number of boxes along z

              -

              useBoundingBoxes

              useBoundingBoxes: boolean
              +

              useBoundingBoxes

              useBoundingBoxes: boolean

              If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.

              -

              world

              world: null | World
              +

              world

              world: null | World

              The world to search for collisions in.

              -

              Methods

              aabbQuery

              Methods

              aabbQuery

              collisionPairs

              • collisionPairs(world: World, pairs1: Body[], pairs2: Body[]): void

              collisionPairs

              • collisionPairs(world: World, pairs1: Body[], pairs2: Body[]): void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              Returns void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              setWorld

              • setWorld(world: World): void

              setWorld

              • setWorld(world: World): void

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Heightfield.html b/docs/classes/Heightfield.html index 19e4390b..70e6347c 100644 --- a/docs/classes/Heightfield.html +++ b/docs/classes/Heightfield.html @@ -5,7 +5,7 @@
              todo

              Refactor elementSize to elementSizeX and elementSizeY

              example
              // Generate some height data (y-values).
              const data = []
              for (let i = 0; i < 1000; i++) {
              const y = 0.5 * Math.cos(0.2 * i)
              data.push(y)
              }

              // Create the heightfield shape
              const heightfieldShape = new CANNON.Heightfield(data, {
              elementSize: 1 // Distance between the data points in X and Y directions
              })
              const heightfieldBody = new CANNON.Body({ shape: heightfieldShape })
              world.addBody(heightfieldBody)
              -

              Hierarchy

              Index

              Constructors

              constructor

              • new Heightfield(data: number[][], options?: { elementSize?: number; maxValue?: null | number; minValue?: null | number }): Heightfield

              Hierarchy

              Index

              Constructors

              constructor

              • new Heightfield(data: number[][], options?: { elementSize?: number; maxValue?: null | number; minValue?: null | number }): Heightfield
              • Parameters

                • data: number[][]

                  An array of numbers, or height values, that are spread out along the x axis.

                • options: { elementSize?: number; maxValue?: null | number; minValue?: null | number } = {}
                  • Optional elementSize?: number

                    World spacing between the data points in X direction.

                    @@ -15,66 +15,66 @@
                  • Optional minValue?: null | number

                    Minimum value of the data points in the data array. Will be computed automatically if not given.

                    -

                Returns Heightfield

              Properties

              body

              body: null | Body
              +

              Returns Heightfield

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              data

              data: number[][]
              +

              data

              data: number[][]

              An array of numbers, or height values, that are spread out along the x axis.

              -

              elementSize

              elementSize: number
              +

              elementSize

              elementSize: number

              World spacing between the data points in X and Y direction.

              todo

              elementSizeX and Y

              default

              1

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              maxValue

              maxValue: null | number
              +

              maxValue

              maxValue: null | number

              Max value of the data points in the data array.

              -

              minValue

              minValue: null | number
              +

              minValue

              minValue: null | number

              Minimum value of the data points in the data array.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              getAabbAtIndex

              • getAabbAtIndex(xi: number, yi: number, result: AABB): void

              getAabbAtIndex

              • getAabbAtIndex(xi: number, yi: number, result: AABB): void

              getConvexTrianglePillar

              • getConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): void

              Returns void

              getConvexTrianglePillar

              • getConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): void
              • Get a triangle in the terrain in the form of a triangular convex shape.

                -

                Parameters

                • xi: number
                • yi: number
                • getUpperTriangle: boolean

                Returns void

              getHeightAt

              • getHeightAt(x: number, y: number, edgeClamp: boolean): number

              getHeightAt

              • getHeightAt(x: number, y: number, edgeClamp: boolean): number
              • Get the height in the heightfield at a given position

                -

                Parameters

                • x: number
                • y: number
                • edgeClamp: boolean

                Returns number

              getIndexOfPosition

              • getIndexOfPosition(x: number, y: number, result: number[], clamp: boolean): boolean

              getIndexOfPosition

              • getIndexOfPosition(x: number, y: number, result: number[], clamp: boolean): boolean
              • Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1.

                Parameters

                • x: number
                • y: number
                • result: number[]

                  Two-element array

                • clamp: boolean

                  If the position should be clamped to the heightfield edge.

                  -

                Returns boolean

              getRectMinMax

              • getRectMinMax(iMinX: number, iMinY: number, iMaxX: number, iMaxY: number, result?: number[]): void

              Returns boolean

              getRectMinMax

              • getRectMinMax(iMinX: number, iMinY: number, iMaxX: number, iMaxY: number, result?: number[]): void
              • Get max/min in a rectangle in the matrix data

                Parameters

                • iMinX: number
                • iMinY: number
                • iMaxX: number
                • iMaxY: number
                • result: number[] = []

                  An array to store the results in.

                Returns void

                The result array, if it was passed in. Minimum will be at position 0 and max at 1.

                -

              getTriangle

              • getTriangle(xi: number, yi: number, upper: boolean, a: Vec3, b: Vec3, c: Vec3): void

              getTriangle

              • getTriangle(xi: number, yi: number, upper: boolean, a: Vec3, b: Vec3, c: Vec3): void

              setHeightValueAtIndex

              • setHeightValueAtIndex(xi: number, yi: number, value: number): void

              setHeightValueAtIndex

              • setHeightValueAtIndex(xi: number, yi: number, value: number): void
              • Set the height value at an index. Don't forget to update maxValue and minValue after you're done.

                -

                Parameters

                • xi: number
                • yi: number
                • value: number

                Returns void

              setHeightsFromImage

              • setHeightsFromImage(image: HTMLImageElement, scale: Vec3): void

              setHeightsFromImage

              • setHeightsFromImage(image: HTMLImageElement, scale: Vec3): void
              • Sets the height values from an image. Currently only supported in browser.

                -

                Parameters

                • image: HTMLImageElement
                • scale: Vec3

                Returns void

              update

              • update(): void

              update

              • update(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateMaxValue

              • updateMaxValue(): void

              updateMaxValue

              • updateMaxValue(): void

              updateMinValue

              • updateMinValue(): void

              updateMinValue

              • updateMinValue(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/HingeConstraint.html b/docs/classes/HingeConstraint.html index eb11cc1f..5f66362c 100644 --- a/docs/classes/HingeConstraint.html +++ b/docs/classes/HingeConstraint.html @@ -1,6 +1,6 @@ HingeConstraint | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class HingeConstraint

              Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              • Parameters

                • bodyA: Body
                • bodyB: Body
                • options: { axisA?: Vec3; axisB?: Vec3; collideConnected?: boolean; maxForce?: number; pivotA?: Vec3; pivotB?: Vec3 } = {}
                  • Optional axisA?: Vec3

                    An axis that bodyA can rotate around, defined locally in bodyA.

                  • Optional axisB?: Vec3

                    An axis that bodyB can rotate around, defined locally in bodyB.

                    @@ -14,34 +14,34 @@

                    A point defined locally in bodyA. This defines the offset of axisA.

                  • Optional pivotB?: Vec3

                    A point defined locally in bodyB. This defines the offset of axisB.

                    -

                Returns HingeConstraint

              Properties

              axisA

              axisA: Vec3
              +

              Returns HingeConstraint

              Properties

              axisA

              axisA: Vec3

              Rotation axis, defined locally in bodyA.

              -

              axisB

              axisB: Vec3
              +

              axisB

              axisB: Vec3

              Rotation axis, defined locally in bodyB.

              -

              bodyA

              bodyA: Body
              +

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              pivotA

              pivotA: Vec3
              +

              pivotA

              pivotA: Vec3

              Pivot, defined locally in bodyA.

              -

              pivotB

              pivotB: Vec3
              +

              pivotB

              pivotB: Vec3

              Pivot, defined locally in bodyB.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              disableMotor

              • disableMotor(): void

              disableMotor

              • disableMotor(): void

              enable

              • enable(): void

              enable

              • enable(): void

              enableMotor

              • enableMotor(): void

              enableMotor

              • enableMotor(): void

              setMotorMaxForce

              • setMotorMaxForce(maxForce: number): void

              setMotorMaxForce

              • setMotorMaxForce(maxForce: number): void

              setMotorSpeed

              • setMotorSpeed(speed: number): void

              setMotorSpeed

              • setMotorSpeed(speed: number): void

              update

              • update(): void

              update

              • update(): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/JacobianElement.html b/docs/classes/JacobianElement.html index a6268b6e..c83ce240 100644 --- a/docs/classes/JacobianElement.html +++ b/docs/classes/JacobianElement.html @@ -1,11 +1,11 @@ JacobianElement | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class JacobianElement

              An element containing 6 entries, 3 spatial and 3 rotational degrees of freedom.

              -

              Hierarchy

              • JacobianElement

              Index

              Constructors

              constructor

              Properties

              rotational

              rotational: Vec3
              +

              Hierarchy

              • JacobianElement

              Index

              Constructors

              constructor

              Properties

              rotational

              rotational: Vec3

              rotational

              -

              spatial

              spatial: Vec3
              +

              spatial

              spatial: Vec3

              spatial

              -

              Methods

              multiplyElement

              Methods

              multiplyElement

              multiplyVectors

              • multiplyVectors(spatial: Vec3, rotational: Vec3): number

              multiplyVectors

              • multiplyVectors(spatial: Vec3, rotational: Vec3): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/LockConstraint.html b/docs/classes/LockConstraint.html index e07da064..ab903f3d 100644 --- a/docs/classes/LockConstraint.html +++ b/docs/classes/LockConstraint.html @@ -1,24 +1,24 @@ LockConstraint | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class LockConstraint

              Lock constraint. Will remove all degrees of freedom between the bodies.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              bodyA

              bodyA: Body
              +

              Returns LockConstraint

              Properties

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              pivotA

              pivotA: Vec3
              +

              pivotA

              pivotA: Vec3

              Pivot, defined locally in bodyA.

              -

              pivotB

              pivotB: Vec3
              +

              pivotB

              pivotB: Vec3

              Pivot, defined locally in bodyB.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              enable

              • enable(): void

              enable

              • enable(): void

              update

              • update(): void

              update

              • update(): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Mat3.html b/docs/classes/Mat3.html index f0471950..a8d06294 100644 --- a/docs/classes/Mat3.html +++ b/docs/classes/Mat3.html @@ -1,40 +1,40 @@ Mat3 | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Mat3

              A 3x3 matrix. Authored by schteppe

              -

              Hierarchy

              • Mat3

              Index

              Constructors

              constructor

              • new Mat3(elements?: number[]): Mat3

              Hierarchy

              • Mat3

              Index

              Constructors

              constructor

              • new Mat3(elements?: number[]): Mat3
              • Parameters

                • elements: number[] = ...

                  A vector of length 9, containing all matrix elements.

                  -

                Returns Mat3

              Properties

              elements

              elements: number[]
              +

              Returns Mat3

              Properties

              elements

              elements: number[]

              A vector of length 9, containing all matrix elements.

              -

              Methods

              copy

              Methods

              copy

              e

              • e(row: number, column: number): number
              • e(row: number, column: number, value: number): void

              e

              • e(row: number, column: number): number
              • e(row: number, column: number, value: number): void
              • Get an element in the matrix by index. Index starts at 0, not 1!!!

                -

                Parameters

                • row: number
                • column: number

                Returns number

              • Parameters

                • row: number
                • column: number
                • value: number

                Returns void

              getTrace

              • +

                Parameters

                • row: number
                • column: number

                Returns number

              • Parameters

                • row: number
                • column: number
                • value: number

                Returns void

              getTrace

              identity

              • identity(): void

              identity

              • identity(): void
              • Sets the matrix to identity

                todo

                Should perhaps be renamed to setIdentity() to be more clear.

                todo

                Create another function that immediately creates an identity matrix eg. eye()

                -

                Returns void

              mmult

              mmult

              • Matrix multiplication

                Parameters

                • matrix: Mat3

                  Matrix to multiply with from left side.

                  -
                • target: Mat3 = ...

                Returns Mat3

              reverse

              Returns Mat3

              reverse

              • reverse the matrix

                Parameters

                • target: Mat3 = ...

                  Target matrix to save in.

                Returns Mat3

                The solution x

                -

              scale

              scale

              setRotationFromQuaternion

              setRotationFromQuaternion

              setTrace

              • setTrace(vector: Vec3): void

              setTrace

              • setTrace(vector: Vec3): void
              • Sets the matrix diagonal elements from a Vec3

                -

                Parameters

                Returns void

              setZero

              • setZero(): void

              setZero

              • setZero(): void

              smult

              • smult(s: number): void

              smult

              • smult(s: number): void
              • Matrix-scalar multiplication

                -

                Parameters

                • s: number

                Returns void

              solve

              solve

              • Solve Ax=b

                todo

                should reuse arrays

                Parameters

                • b: Vec3
                  @@ -42,14 +42,14 @@
                • target: Vec3 = ...

                  Optional. Target vector to save in.

                Returns Vec3

                The solution x

                -

              toString

              • toString(): string

              toString

              • toString(): string
              • Returns a string representation of the matrix.

                -

                Returns string

              transpose

              transpose

              • Transpose the matrix

                Parameters

                • target: Mat3 = ...

                  Optional. Where to store the result.

                Returns Mat3

                The target Mat3, or a new Mat3 if target was omitted.

                -

              vmult

              vmult

              collisionPairs

              • collisionPairs(world: World, pairs1: Body[], pairs2: Body[]): void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingBoxBroadphase

              • doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              doBoundingSphereBroadphase

              • doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              Returns void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              setWorld

              • setWorld(world: World): void

              setWorld

              • setWorld(world: World): void

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Narrowphase.html b/docs/classes/Narrowphase.html index ed1d5bd1..e8ffaf00 100644 --- a/docs/classes/Narrowphase.html +++ b/docs/classes/Narrowphase.html @@ -3,15 +3,15 @@
              todo

              Sphere-ConvexPolyhedron contacts

              todo

              Contact reduction

              todo

              should move methods to prototype

              -

              Hierarchy

              • Narrowphase

              Index

              Constructors

              constructor

              Properties

              contactPointPool

              contactPointPool: ContactEquation[]
              +

              Hierarchy

              • Narrowphase

              Index

              Constructors

              constructor

              Properties

              contactPointPool

              contactPointPool: ContactEquation[]

              Internal storage of pooled contact points.

              -

              v3pool

              v3pool: Vec3Pool
              +

              v3pool

              v3pool: Vec3Pool

              Pooled vectors.

              -

              Methods

              createContactEquation

              Methods

              createContactEquation

              createFrictionFromAverage

              • createFrictionFromAverage(numContacts: number): void

              createFrictionFromAverage

              • createFrictionFromAverage(numContacts: number): void
              • Take the average N latest contact point on the plane.

                -

                Parameters

                • numContacts: number

                Returns void

              getContacts

              getContacts

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Plane.html b/docs/classes/Plane.html index 8a0afb4e..3b902cde 100644 --- a/docs/classes/Plane.html +++ b/docs/classes/Plane.html @@ -2,32 +2,32 @@

              A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos.

              example
              const planeShape = new CANNON.Plane()
              const planeBody = new CANNON.Body({ mass: 0, shape: planeShape })
              planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up
              world.addBody(planeBody)
              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              worldNormal

              worldNormal: Vec3
              +

              worldNormal

              worldNormal: Vec3

              worldNormal

              -

              worldNormalNeedsUpdate

              worldNormalNeedsUpdate: boolean
              +

              worldNormalNeedsUpdate

              worldNormalNeedsUpdate: boolean

              worldNormalNeedsUpdate

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              computeWorldNormal

              computeWorldNormal

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/PointToPointConstraint.html b/docs/classes/PointToPointConstraint.html index 4315be4a..cd8a03aa 100644 --- a/docs/classes/PointToPointConstraint.html +++ b/docs/classes/PointToPointConstraint.html @@ -2,7 +2,7 @@

              Connects two bodies at given offset points.

              example
              const bodyA = new Body({ mass: 1 })
              const bodyB = new Body({ mass: 1 })
              bodyA.position.set(-1, 0, 0)
              bodyB.position.set(1, 0, 0)
              bodyA.addShape(shapeA)
              bodyB.addShape(shapeB)
              world.addBody(bodyA)
              world.addBody(bodyB)
              const localPivotA = new Vec3(1, 0, 0)
              const localPivotB = new Vec3(-1, 0, 0)
              const constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB)
              world.addConstraint(constraint)
              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              • Parameters

                • bodyA: Body
                • pivotA: Vec3 = ...

                  The point relative to the center of mass of bodyA which bodyA is constrained to.

                • bodyB: Body

                  Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.

                  @@ -10,22 +10,22 @@

                  The point relative to the center of mass of bodyB which bodyB is constrained to.

                • maxForce: number = 1e6

                  The maximum force that should be applied to constrain the bodies.

                  -

                Returns PointToPointConstraint

              Properties

              bodyA

              bodyA: Body
              +

              Returns PointToPointConstraint

              Properties

              bodyA

              bodyA: Body

              Body A.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Body B.

              -

              collideConnected

              collideConnected: boolean
              +

              collideConnected

              collideConnected: boolean

              Set to false if you don't want the bodies to collide when they are connected.

              -

              equations

              equations: Equation[]
              +

              equations

              equations: Equation[]

              Equations to be solved in this constraint.

              -

              pivotA

              pivotA: Vec3
              +

              pivotA

              pivotA: Vec3

              Pivot, defined locally in bodyA.

              -

              pivotB

              pivotB: Vec3
              +

              pivotB

              pivotB: Vec3

              Pivot, defined locally in bodyB.

              -

              Methods

              disable

              • disable(): void

              Methods

              disable

              • disable(): void

              enable

              • enable(): void

              enable

              • enable(): void

              update

              • update(): void

              update

              • update(): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Pool.html b/docs/classes/Pool.html index f6d630a3..9ce608ab 100644 --- a/docs/classes/Pool.html +++ b/docs/classes/Pool.html @@ -1,13 +1,13 @@ Pool | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Pool

              For pooling objects that can be reused.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              objects

              objects: any[] = []
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              objects

              objects: any[] = []

              The objects array.

              -

              type

              type: any = Object
              +

              type

              type: any = Object

              The type of the objects.

              -

              Methods

              constructObject

              • constructObject(): void

              Methods

              constructObject

              • constructObject(): void
              • Construct an object. Should be implemented in each subclass.

                -

                Returns void

              get

              • get(): any

              get

              • get(): any

              release

              • release(...args: any[]): Pool

              release

              • release(...args: any[]): Pool

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Quaternion.html b/docs/classes/Quaternion.html index 74a9cb87..32379410 100644 --- a/docs/classes/Quaternion.html +++ b/docs/classes/Quaternion.html @@ -5,34 +5,34 @@
              param z

              Multiplier of the imaginary basis vector k.

              param w

              Multiplier of the real part.

              see

              http://en.wikipedia.org/wiki/Quaternion

              -

              Hierarchy

              • Quaternion

              Index

              Constructors

              constructor

              • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion

              Methods

              conjugate

              Hierarchy

              • Quaternion

              Index

              Constructors

              constructor

              • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion

              Methods

              conjugate

              copy

              copy

              integrate

              integrate

              inverse

              inverse

              mult

              mult

              normalize

              normalize

              normalizeFast

              normalizeFast

              set

              • set(x: number, y: number, z: number, w: number): Quaternion

              set

              • set(x: number, y: number, z: number, w: number): Quaternion

              setFromAxisAngle

              setFromAxisAngle

              setFromEuler

              • setFromEuler(x: number, y: number, z: number, order?: string): Quaternion

              setFromEuler

              • setFromEuler(x: number, y: number, z: number, order?: string): Quaternion
              • Set the quaternion components given Euler angle representation.

                Parameters

                • x: number
                • y: number
                • z: number
                • order: string = 'XYZ'

                  The order to apply angles: 'XYZ' or 'YXZ' or any other combination.

                  See MathWorks reference

                  -

                Returns Quaternion

              setFromVectors

              Returns Quaternion

              setFromVectors

              slerp

              slerp

              • Performs a spherical linear interpolation between two quat

                Parameters

                • toQuat: Quaternion

                  second operand

                  @@ -41,20 +41,20 @@
                • target: Quaternion = ...

                  A quaternion to store the result in. If not provided, a new one will be created.

                Returns Quaternion

                The "target" object

                -

              toArray

              • toArray(): [number, number, number, number]

              toArray

              • toArray(): [number, number, number, number]

              toAxisAngle

              • toAxisAngle(targetAxis?: Vec3): [Vec3, number]

              toAxisAngle

              • toAxisAngle(targetAxis?: Vec3): [Vec3, number]
              • Converts the quaternion to [ axis, angle ] representation.

                Parameters

                • targetAxis: Vec3 = ...

                  A vector object to reuse for storing the axis.

                Returns [Vec3, number]

                An array, first element is the axis and the second is the angle in radians.

                -

              toEuler

              • toEuler(target: Vec3, order?: string): void

              toEuler

              • toEuler(target: Vec3, order?: string): void

              toString

              • toString(): string

              Returns void

              toString

              • toString(): string

              vmult

              vmult

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Ray.html b/docs/classes/Ray.html index 0a4a990a..c9438e10 100644 --- a/docs/classes/Ray.html +++ b/docs/classes/Ray.html @@ -1,55 +1,55 @@ Ray | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Ray

              A line in 3D space that intersects bodies and return points.

              -

              Hierarchy

              • Ray

              Index

              Constructors

              constructor

              Properties

              callback

              callback: RaycastCallback
              +

              Hierarchy

              • Ray

              Index

              Constructors

              constructor

              Properties

              callback

              callback: RaycastCallback

              User-provided result callback. Will be used if mode is Ray.ALL.

              -

              checkCollisionResponse

              checkCollisionResponse: boolean
              +

              checkCollisionResponse

              checkCollisionResponse: boolean

              Set to false if you don't want the Ray to take collisionResponse flags into account on bodies and shapes.

              default

              true

              -

              collisionFilterGroup

              collisionFilterGroup: number
              +

              collisionFilterGroup

              collisionFilterGroup: number

              collisionFilterGroup

              default

              -1

              -

              collisionFilterMask

              collisionFilterMask: number
              +

              collisionFilterMask

              collisionFilterMask: number

              collisionFilterMask

              default

              -1

              -

              direction

              direction: Vec3
              +

              direction

              direction: Vec3

              direction

              -

              from

              from: Vec3
              +

              from

              from: Vec3

              from

              -

              hasHit

              hasHit: boolean
              +

              hasHit

              hasHit: boolean

              Will be set to true during intersectWorld() if the ray hit anything.

              -

              mode

              mode: number
              +

              mode

              mode: number

              The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.

              default

              RAY.ANY

              -

              precision

              precision: number
              +

              precision

              precision: number

              The precision of the ray. Used when checking parallelity etc.

              default

              0.0001

              -

              result

              +

              result

              Current result object.

              -

              skipBackfaces

              skipBackfaces: boolean
              +

              skipBackfaces

              skipBackfaces: boolean

              If set to true, the ray skips any hits with normal.dot(rayDirection) < 0.

              default

              false

              -

              to

              to: Vec3
              +

              to

              to: Vec3

              to

              -

              Static ALL

              ALL: 4 = RAY_MODES.ALL
              +

              Static ALL

              ALL: 4 = RAY_MODES.ALL

              ALL

              -

              Static ANY

              ANY: 2 = RAY_MODES.ANY
              +

              Static ANY

              ANY: 2 = RAY_MODES.ANY

              ANY

              -

              Static CLOSEST

              CLOSEST: 1 = RAY_MODES.CLOSEST
              +

              Static CLOSEST

              CLOSEST: 1 = RAY_MODES.CLOSEST

              CLOSEST

              -

              Methods

              getAABB

              • getAABB(aabb: AABB): void

              Methods

              getAABB

              • getAABB(aabb: AABB): void

              intersectBodies

              intersectBodies

              • Shoot a ray at an array bodies, get back information about the hit.

                deprecated

                @param result set the result property of the Ray instead.

                Parameters

                Returns void

              intersectBody

              Returns void

              intersectBody

              • Shoot a ray at a body, get back information about the hit.

                deprecated

                @param result set the result property of the Ray instead.

                -

                Parameters

                Returns void

              intersectWorld

              intersectWorld

              • Do itersection against all bodies in the given World.

                Parameters

                Returns boolean

                True if the ray hit anything, otherwise false.

                -

              Static pointInTriangle

              Static pointInTriangle

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/RaycastResult.html b/docs/classes/RaycastResult.html index 9dab5318..52771c41 100644 --- a/docs/classes/RaycastResult.html +++ b/docs/classes/RaycastResult.html @@ -1,29 +1,29 @@ RaycastResult | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class RaycastResult

              Storage for Ray casting data

              -

              Hierarchy

              • RaycastResult

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body
              +

              Hierarchy

              • RaycastResult

              Index

              Constructors

              constructor

              Properties

              body

              body: null | Body

              body

              -

              distance

              distance: number
              +

              distance

              distance: number

              Distance to the hit. Will be set to -1 if there was no hit

              -

              hasHit

              hasHit: boolean
              +

              hasHit

              hasHit: boolean

              hasHit

              -

              hitFaceIndex

              hitFaceIndex: number
              +

              hitFaceIndex

              hitFaceIndex: number

              The index of the hit triangle, if the hit shape was a trimesh

              -

              hitNormalWorld

              hitNormalWorld: Vec3
              +

              hitNormalWorld

              hitNormalWorld: Vec3

              hitNormalWorld

              -

              hitPointWorld

              hitPointWorld: Vec3
              +

              hitPointWorld

              hitPointWorld: Vec3

              hitPointWorld

              -

              rayFromWorld

              rayFromWorld: Vec3
              +

              rayFromWorld

              rayFromWorld: Vec3

              rayFromWorld

              -

              rayToWorld

              rayToWorld: Vec3
              +

              rayToWorld

              rayToWorld: Vec3

              rayToWorld

              -

              shape

              shape: null | Shape
              +

              shape

              shape: null | Shape

              shape

              -

              shouldStop

              shouldStop: boolean
              +

              shouldStop

              shouldStop: boolean

              If the ray should stop traversing the bodies

              -

              Methods

              abort

              • abort(): void

              Methods

              abort

              • abort(): void

              reset

              • reset(): void

              reset

              • reset(): void

              set

              • set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void

              set

              • set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/RaycastVehicle.html b/docs/classes/RaycastVehicle.html index 10efccf6..9c357c27 100644 --- a/docs/classes/RaycastVehicle.html +++ b/docs/classes/RaycastVehicle.html @@ -1,6 +1,6 @@ RaycastVehicle | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class RaycastVehicle

              Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.

              -

              Hierarchy

              • RaycastVehicle

              Index

              Constructors

              constructor

              • new RaycastVehicle(options: { chassisBody: Body; indexForwardAxis?: number; indexRightAxis?: number; indexUpAxis?: number }): RaycastVehicle

              Hierarchy

              • RaycastVehicle

              Index

              Constructors

              constructor

              • new RaycastVehicle(options: { chassisBody: Body; indexForwardAxis?: number; indexRightAxis?: number; indexUpAxis?: number }): RaycastVehicle
              • Parameters

                • options: { chassisBody: Body; indexForwardAxis?: number; indexRightAxis?: number; indexUpAxis?: number }
                  • chassisBody: Body

                    The car chassis body.

                  • Optional indexForwardAxis?: number

                    Index of the forward axis. x=0, y=1, z=2

                    @@ -8,39 +8,39 @@

                    Index of the right axis. x=0, y=1, z=2

                  • Optional indexUpAxis?: number

                    Index of the up axis. x=0, y=1, z=2

                    -

                Returns RaycastVehicle

              Properties

              chassisBody

              chassisBody: Body
              +

              Returns RaycastVehicle

              Properties

              chassisBody

              chassisBody: Body

              The car chassis body.

              -

              constraints

              constraints: Constraint[]
              +

              constraints

              constraints: Constraint[]

              The constraints.

              -

              indexForwardAxis

              indexForwardAxis: number
              +

              indexForwardAxis

              indexForwardAxis: number

              Index of the forward axis. x=0, y=1, z=2

              -

              indexRightAxis

              indexRightAxis: number
              +

              indexRightAxis

              indexRightAxis: number

              Index of the right axis. x=0, y=1, z=2

              -

              indexUpAxis

              indexUpAxis: number
              +

              indexUpAxis

              indexUpAxis: number

              Index of the up axis. x=0, y=1, z=2

              -

              numWheelsOnGround

              numWheelsOnGround: number
              +

              numWheelsOnGround

              numWheelsOnGround: number

              Number of wheels on the ground.

              -

              preStepCallback

              preStepCallback: () => void

              Type declaration

                • (): void
                • +

              preStepCallback

              preStepCallback: () => void

              Type declaration

                • (): void
                • Optional pre-step callback.

                  -

                  Returns void

              sliding

              sliding: boolean
              +

              Returns void

              sliding

              sliding: boolean

              Will be set to true if the car is sliding.

              -

              wheelInfos

              wheelInfos: WheelInfo[]
              +

              wheelInfos

              wheelInfos: WheelInfo[]

              The wheels.

              -

              Methods

              addToWorld

              • addToWorld(world: World): void

              Methods

              addToWorld

              • addToWorld(world: World): void

              addWheel

              • addWheel(options?: undefined | { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean }): number

              addWheel

              • addWheel(options?: undefined | { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean }): number
              • Add a wheel. For information about the options, see WheelInfo.

                -

                Parameters

                • options: undefined | { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean } = {}

                Returns number

              applyEngineForce

              • applyEngineForce(value: number, wheelIndex: number): void
              • +

                Parameters

                • options: undefined | { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean } = {}

                Returns number

              applyEngineForce

              • applyEngineForce(value: number, wheelIndex: number): void
              • Set the wheel force to apply on one of the wheels each time step

                -

                Parameters

                • value: number
                • wheelIndex: number

                Returns void

              getWheelTransformWorld

              • getWheelTransformWorld(wheelIndex: number): Transform

              getWheelTransformWorld

              • getWheelTransformWorld(wheelIndex: number): Transform

              removeFromWorld

              • removeFromWorld(world: World): void

              removeFromWorld

              • removeFromWorld(world: World): void

              setBrake

              • setBrake(brake: number, wheelIndex: number): void

              setBrake

              • setBrake(brake: number, wheelIndex: number): void

              setSteeringValue

              • setSteeringValue(value: number, wheelIndex: number): void

              setSteeringValue

              • setSteeringValue(value: number, wheelIndex: number): void

              updateWheelTransform

              • updateWheelTransform(wheelIndex: number): void

              updateWheelTransform

              • updateWheelTransform(wheelIndex: number): void

              Returns RigidVehicle

              Properties

              chassisBody

              chassisBody: Body

              The chassis body.

              -

              constraints

              constraints: (HingeConstraint & {})[]
              +

              constraints

              constraints: (HingeConstraint & {})[]

              The constraints.

              -

              wheelAxes

              wheelAxes: Vec3[]
              +

              wheelAxes

              wheelAxes: Vec3[]

              The wheel axes.

              -

              wheelBodies

              wheelBodies: Body[]
              +

              wheelBodies

              wheelBodies: Body[]

              The bodies of the wheels.

              -

              wheelForces

              wheelForces: number[]
              +

              wheelForces

              wheelForces: number[]

              The wheel forces.

              -

              Methods

              addToWorld

              • addToWorld(world: World): void

              Methods

              addToWorld

              • addToWorld(world: World): void

              addWheel

              • addWheel(options?: { axis?: Vec3; body?: Body; direction?: Vec3; position?: Vec3 }): number

              addWheel

              • addWheel(options?: { axis?: Vec3; body?: Body; direction?: Vec3; position?: Vec3 }): number
              • Add a wheel

                Parameters

                • options: { axis?: Vec3; body?: Body; direction?: Vec3; position?: Vec3 } = {}
                  • Optional axis?: Vec3

                    Axis of rotation of the wheel, locally defined in the chassis.

                    @@ -27,19 +27,19 @@

                    Slide direction of the wheel along the suspension.

                  • Optional position?: Vec3

                    Position of the wheel, locally in the chassis body.

                    -

                Returns number

              applyWheelForce

              • applyWheelForce(value: number, wheelIndex: number): void

              Returns number

              applyWheelForce

              • applyWheelForce(value: number, wheelIndex: number): void

              disableMotor

              • disableMotor(wheelIndex: number): void

              disableMotor

              • disableMotor(wheelIndex: number): void
              • Set the target rotational speed of the hinge constraint.

                -

                Parameters

                • wheelIndex: number

                Returns void

              getWheelSpeed

              • getWheelSpeed(wheelIndex: number): number

              getWheelSpeed

              • getWheelSpeed(wheelIndex: number): number

              removeFromWorld

              • removeFromWorld(world: World): void

              removeFromWorld

              • removeFromWorld(world: World): void

              setMotorSpeed

              • setMotorSpeed(value: number, wheelIndex: number): void

              setMotorSpeed

              • setMotorSpeed(value: number, wheelIndex: number): void
              • Set the target rotational speed of the hinge constraint.

                -

                Parameters

                • value: number
                • wheelIndex: number

                Returns void

              setSteeringValue

              • setSteeringValue(value: number, wheelIndex: number): void

              setSteeringValue

              • setSteeringValue(value: number, wheelIndex: number): void
              • Set the steering value of a wheel.

                todo

                check coordinateSystem

                -

                Parameters

                • value: number
                • wheelIndex: number

                Returns void

              setWheelForce

              • setWheelForce(value: number, wheelIndex: number): void

              setWheelForce

              • setWheelForce(value: number, wheelIndex: number): void
              • Set the wheel force to apply on one of the wheels each time step

                Parameters

                • value: number
                • wheelIndex: number

                Returns void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/RotationalEquation.html b/docs/classes/RotationalEquation.html index 4efa3945..1b235d18 100644 --- a/docs/classes/RotationalEquation.html +++ b/docs/classes/RotationalEquation.html @@ -1,46 +1,46 @@ RotationalEquation | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class RotationalEquation

              Rotational constraint. Works to keep the local vectors orthogonal to each other in world space.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              a

              a: number
              +

              Returns RotationalEquation

              Properties

              a

              a: number

              SPOOK parameter

              -

              axisA

              axisA: Vec3
              +

              axisA

              axisA: Vec3

              World oriented rotational axis.

              -

              axisB

              axisB: Vec3
              +

              axisB

              axisB: Vec3

              World oriented rotational axis.

              -

              b

              b: number
              +

              b

              b: number

              SPOOK parameter

              -

              eps

              eps: number
              +

              eps

              eps: number

              SPOOK parameter

              -

              maxAngle

              maxAngle: number
              +

              maxAngle

              maxAngle: number

              maxAngle

              -

              maxForce

              maxForce: number
              +

              maxForce

              maxForce: number

              Maximum (read: positive max) force to be applied by the constraint.

              -

              minForce

              minForce: number
              +

              minForce

              minForce: number

              Minimum (read: negative max) force to be applied by the constraint.

              -

              multiplier

              multiplier: number
              +

              multiplier

              multiplier: number

              A number, proportional to the force added to the bodies.

              -

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              Methods

              addToWlambda

              • addToWlambda(deltalambda: number): void

              computeB

              • computeB(h: number): number

              computeB

              • computeB(h: number): number

              computeC

              • computeC(): number

              computeC

              • computeC(): number

              computeGW

              • computeGW(): number

              computeGW

              • computeGW(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGWlambda

              • computeGWlambda(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMGt

              • computeGiMGt(): number

              computeGiMf

              • computeGiMf(): number

              computeGiMf

              • computeGiMf(): number

              computeGq

              • computeGq(): number

              computeGq

              • computeGq(): number

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              setSpookParams

              • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void

              intersectionTest

              • intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              makePairsUnique

              • makePairsUnique(pairs1: Body[], pairs2: Body[]): void

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              needBroadphaseCollision

              • needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean

              setWorld

              • setWorld(world: World): void

              setWorld

              • setWorld(world: World): void

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Static boundingSphereCheck

              • boundingSphereCheck(bodyA: Body, bodyB: Body): boolean

              Static checkBounds

              • checkBounds(bi: Body, bj: Body, axisIndex: 0 | 1 | 2): boolean

              Static checkBounds

              • checkBounds(bi: Body, bj: Body, axisIndex: 0 | 1 | 2): boolean

              Static insertionSortX

              Static insertionSortX

              Static insertionSortY

              Static insertionSortY

              Static insertionSortZ

              Static insertionSortZ

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/SPHSystem.html b/docs/classes/SPHSystem.html index 473021ad..46b13016 100644 --- a/docs/classes/SPHSystem.html +++ b/docs/classes/SPHSystem.html @@ -1,22 +1,22 @@ SPHSystem | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class SPHSystem

              Smoothed-particle hydrodynamics system

              todo

              Make parameters customizable in the constructor

              -

              Hierarchy

              • SPHSystem

              Index

              Constructors

              constructor

              Properties

              density

              density: number
              +

              Hierarchy

              • SPHSystem

              Index

              Constructors

              constructor

              Properties

              density

              density: number

              Density of the system (kg/m3).

              default

              1

              -

              particles

              particles: Body[]
              +

              particles

              particles: Body[]

              The particles array.

              -

              smoothingRadius

              smoothingRadius: number
              +

              smoothingRadius

              smoothingRadius: number

              Distance below which two particles are considered to be neighbors. It should be adjusted so there are about 15-20 neighbor particles within this radius.

              default

              1

              -

              viscosity

              viscosity: number
              +

              viscosity

              viscosity: number

              Viscosity of the system.

              default

              0.01

              -

              Methods

              add

              • add(particle: Body): void

              Methods

              add

              • add(particle: Body): void

              getNeighbors

              • getNeighbors(particle: Body, neighbors: Body[]): void

              getNeighbors

              • getNeighbors(particle: Body, neighbors: Body[]): void
              • Get neighbors within smoothing volume, save in the array neighbors

                -

                Parameters

                Returns void

              remove

              • remove(particle: Body): void

              remove

              • remove(particle: Body): void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Shape.html b/docs/classes/Shape.html index 057fa566..107884cb 100644 --- a/docs/classes/Shape.html +++ b/docs/classes/Shape.html @@ -1,6 +1,6 @@ Shape | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Shape

              Base class for shapes

              -

              Hierarchy

              Index

              Constructors

              constructor

              Hierarchy

              Index

              Constructors

              constructor

              • Parameters

                • options: { collisionResponse?: boolean; material?: Material; type?: ShapeType } = {}
                  • Optional collisionResponse?: boolean

                    Whether to produce contact forces when in contact with other bodies.

                    default

                    true

                  • Optional material?: Material
                    @@ -9,27 +9,27 @@
                    todo

                    check this, the material is passed to the body, right?

                  • Optional type?: ShapeType

                    The type of this shape.

                    -

                Returns Shape

              Properties

              body

              body: null | Body
              +

              Returns Shape

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void
              • +

                Type declaration

                • BOX: 4
                • COMPOUND: 8
                • CONVEXPOLYHEDRON: 16
                • CYLINDER: 128
                • HEIGHTFIELD: 32
                • PARTICLE: 64
                • PLANE: 2
                • SPHERE: 1
                • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void
              • Computes the bounding sphere radius. The result is stored in the property .boundingSphereRadius

                -

                Returns void

              volume

              • volume(): number

              volume

              • volume(): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Solver.html b/docs/classes/Solver.html index e75d1ed1..76943b69 100644 --- a/docs/classes/Solver.html +++ b/docs/classes/Solver.html @@ -1,15 +1,15 @@ Solver | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Solver

              Constraint equation solver base class.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]

              All equations to be solved

              -

              Methods

              addEquation

              Methods

              addEquation

              removeAllEquations

              • removeAllEquations(): void

              removeAllEquations

              • removeAllEquations(): void

              removeEquation

              removeEquation

              solve

              • solve(dt: number, world: World): number

              solve

              • solve(dt: number, world: World): number
              • Should be implemented in subclasses!

                todo

                use abstract

                Parameters

                Returns number

                number of iterations performed

                diff --git a/docs/classes/Sphere.html b/docs/classes/Sphere.html index dda43813..495aeb4e 100644 --- a/docs/classes/Sphere.html +++ b/docs/classes/Sphere.html @@ -2,30 +2,30 @@

                Spherical shape

                example
                const radius = 1
                const sphereShape = new CANNON.Sphere(radius)
                const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape })
                world.addBody(sphereBody)
                -

              Hierarchy

              Index

              Constructors

              constructor

              • new Sphere(radius: number): Sphere

              Hierarchy

              Index

              Constructors

              constructor

              • new Sphere(radius: number): Sphere

              Properties

              body

              body: null | Body
              +

              Returns Sphere

              Properties

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              radius

              radius: number
              +

              radius

              radius: number

              The radius of the sphere.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target?: Vec3): Vec3

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/SplitSolver.html b/docs/classes/SplitSolver.html index 7af09653..91aac2d8 100644 --- a/docs/classes/SplitSolver.html +++ b/docs/classes/SplitSolver.html @@ -1,22 +1,22 @@ SplitSolver | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class SplitSolver

              Splits the equations into islands and solves them independently. Can improve performance.

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              equations

              equations: Equation[]

              All equations to be solved

              -

              iterations

              iterations: number
              +

              iterations

              iterations: number

              The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.

              -

              subsolver

              subsolver: GSSolver
              +

              subsolver

              subsolver: GSSolver

              subsolver

              -

              tolerance

              tolerance: number
              +

              tolerance

              tolerance: number

              When tolerance is reached, the system is assumed to be converged.

              -

              Methods

              addEquation

              Methods

              addEquation

              createNode

              • createNode(): SplitSolverNode

              createNode

              • createNode(): SplitSolverNode

              removeAllEquations

              • removeAllEquations(): void

              removeAllEquations

              • removeAllEquations(): void

              removeEquation

              removeEquation

              solve

              • solve(dt: number, world: World): number

              solve

              • solve(dt: number, world: World): number

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Spring.html b/docs/classes/Spring.html index c524e667..20ffcd5a 100644 --- a/docs/classes/Spring.html +++ b/docs/classes/Spring.html @@ -2,7 +2,7 @@

              A spring, connecting two bodies.

              example
              const spring = new Spring(boxBody, sphereBody, {
              restLength: 0,
              stiffness: 50,
              damping: 1,
              })

              // Compute the force after each step
              world.addEventListener('postStep', (event) => {
              spring.applyForce()
              })
              -

              Hierarchy

              • Spring

              Index

              Constructors

              constructor

              • new Spring(bodyA: Body, bodyB: Body, options?: { damping?: number; localAnchorA?: Vec3; localAnchorB?: Vec3; restLength?: number; stiffness?: number; worldAnchorA?: Vec3; worldAnchorB?: Vec3 }): Spring
              • Parameters

                • bodyA: Body
                • bodyB: Body
                • options: { damping?: number; localAnchorA?: Vec3; localAnchorB?: Vec3; restLength?: number; stiffness?: number; worldAnchorA?: Vec3; worldAnchorB?: Vec3 } = {}
                  • Optional damping?: number
                    +

              Hierarchy

              • Spring

              Index

              Constructors

              constructor

              • new Spring(bodyA: Body, bodyB: Body, options?: { damping?: number; localAnchorA?: Vec3; localAnchorB?: Vec3; restLength?: number; stiffness?: number; worldAnchorA?: Vec3; worldAnchorB?: Vec3 }): Spring
              • Parameters

                • bodyA: Body
                • bodyB: Body
                • options: { damping?: number; localAnchorA?: Vec3; localAnchorB?: Vec3; restLength?: number; stiffness?: number; worldAnchorA?: Vec3; worldAnchorB?: Vec3 } = {}
                  • Optional damping?: number

                    Damping of the spring. A number >= 0.

                    default

                    1

                  • Optional localAnchorA?: Vec3
                    @@ -23,39 +23,39 @@

                    Where to hook the spring to body A, in world coordinates.

                  • Optional worldAnchorB?: Vec3

                    Where to hook the spring to body B, in world coordinates.

                    -

                Returns Spring

              Properties

              bodyA

              bodyA: Body
              +

              Returns Spring

              Properties

              bodyA

              bodyA: Body

              First connected body.

              -

              bodyB

              bodyB: Body
              +

              bodyB

              bodyB: Body

              Second connected body.

              -

              damping

              damping: number
              +

              damping

              damping: number

              Damping of the spring. A number >= 0.

              default

              1

              -

              localAnchorA

              localAnchorA: Vec3
              +

              localAnchorA

              localAnchorA: Vec3

              Anchor for bodyA in local bodyA coordinates. Where to hook the spring to body A, in local body coordinates.

              default

              new Vec3()

              -

              localAnchorB

              localAnchorB: Vec3
              +

              localAnchorB

              localAnchorB: Vec3

              Anchor for bodyB in local bodyB coordinates. Where to hook the spring to body B, in local body coordinates.

              default

              new Vec3()

              -

              restLength

              restLength: number
              +

              restLength

              restLength: number

              Rest length of the spring. A number > 0.

              default

              1

              -

              stiffness

              stiffness: number
              +

              stiffness

              stiffness: number

              Stiffness of the spring. A number >= 0.

              default

              100

              -

              Methods

              applyForce

              • applyForce(): void

              Methods

              applyForce

              • applyForce(): void

              getWorldAnchorA

              • getWorldAnchorA(result: Vec3): void

              getWorldAnchorA

              • getWorldAnchorA(result: Vec3): void
              • Get the anchor point on body A, in world coordinates.

                Parameters

                • result: Vec3

                  The vector to store the result in.

                  -

                Returns void

              getWorldAnchorB

              • getWorldAnchorB(result: Vec3): void

              Returns void

              getWorldAnchorB

              • getWorldAnchorB(result: Vec3): void
              • Get the anchor point on body B, in world coordinates.

                Parameters

                • result: Vec3

                  The vector to store the result in.

                  -

                Returns void

              setWorldAnchorA

              • setWorldAnchorA(worldAnchorA: Vec3): void

              Returns void

              setWorldAnchorA

              • setWorldAnchorA(worldAnchorA: Vec3): void
              • Set the anchor point on body A, using world coordinates.

                -

                Parameters

                Returns void

              setWorldAnchorB

              • setWorldAnchorB(worldAnchorB: Vec3): void

              setWorldAnchorB

              • setWorldAnchorB(worldAnchorB: Vec3): void
              • Set the anchor point on body B, using world coordinates.

                Parameters

                Returns void

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Transform.html b/docs/classes/Transform.html index ae0d018b..ff68f9b1 100644 --- a/docs/classes/Transform.html +++ b/docs/classes/Transform.html @@ -1,25 +1,25 @@ Transform | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Transform

              Transformation utilities.

              -

              Hierarchy

              • Transform

              Index

              Constructors

              constructor

              Hierarchy

              • Transform

              Index

              Constructors

              constructor

              Properties

              position

              position: Vec3
              +

              Returns Transform

              Properties

              position

              position: Vec3

              position

              -

              quaternion

              quaternion: Quaternion
              +

              quaternion

              quaternion: Quaternion

              quaternion

              -

              Methods

              pointToLocal

              Methods

              pointToLocal

              pointToWorld

              pointToWorld

              vectorToWorldFrame

              vectorToWorldFrame

              Static pointToLocalFrame

              Static pointToLocalFrame

              Static pointToWorldFrame

              Static pointToWorldFrame

              Static vectorToLocalFrame

              Static vectorToLocalFrame

              Static vectorToWorldFrame

              Static vectorToWorldFrame

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Trimesh.html b/docs/classes/Trimesh.html index bff32627..53441636 100644 --- a/docs/classes/Trimesh.html +++ b/docs/classes/Trimesh.html @@ -2,79 +2,79 @@

              Trimesh.

              example
              // How to make a mesh with a single triangle
              const vertices = [
              0, 0, 0, // vertex 0
              1, 0, 0, // vertex 1
              0, 1, 0 // vertex 2
              ]
              const indices = [
              0, 1, 2 // triangle 0
              ]
              const trimeshShape = new CANNON.Trimesh(vertices, indices)
              -

              Hierarchy

              Index

              Constructors

              constructor

              • new Trimesh(vertices: number[], indices: number[]): Trimesh

              Properties

              aabb

              aabb: AABB
              +

              Hierarchy

              Index

              Constructors

              constructor

              • new Trimesh(vertices: number[], indices: number[]): Trimesh

              Properties

              aabb

              aabb: AABB

              The local AABB of the mesh.

              -

              body

              body: null | Body
              +

              body

              body: null | Body

              The body to which the shape is added to.

              -

              boundingSphereRadius

              boundingSphereRadius: number
              +

              boundingSphereRadius

              boundingSphereRadius: number

              The local bounding sphere radius of this shape.

              -

              collisionResponse

              collisionResponse: boolean
              +

              collisionResponse

              collisionResponse: boolean

              Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

              default

              true

              -

              edges

              edges: null | Int16Array
              +

              edges

              edges: null | Int16Array

              References to vertex pairs, making up all unique edges in the trimesh.

              -

              id

              id: number
              +

              id

              id: number

              Identifier of the Shape.

              -

              indices

              indices: Int16Array
              +

              indices

              indices: Int16Array

              Array of integers, indicating which vertices each triangle consists of. The length of this array is thus 3 times the number of triangles.

              -

              material

              material: null | Material
              +

              material

              material: null | Material

              Optional material of the shape that regulates contact properties.

              -

              normals

              normals: Float32Array
              +

              normals

              normals: Float32Array

              The normals data.

              -

              scale

              scale: Vec3
              +

              scale

              scale: Vec3

              Local scaling of the mesh. Use .setScale() to set it.

              -

              tree

              tree: Octree
              +

              tree

              tree: Octree

              The indexed triangles. Use .updateTree() to update it.

              -

              type

              type: 0 | ShapeType
              +

              type

              type: 0 | ShapeType

              The type of this shape. Must be set to an int > 0 by subclasses.

              -

              vertices

              vertices: Float32Array
              +

              vertices

              vertices: Float32Array

              vertices

              -

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES
              +

              Static types

              types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

              All the Shape types.

              -

              Type declaration

              • BOX: 4
              • COMPOUND: 8
              • CONVEXPOLYHEDRON: 16
              • CYLINDER: 128
              • HEIGHTFIELD: 32
              • PARTICLE: 64
              • PLANE: 2
              • SPHERE: 1
              • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): Vec3

              calculateWorldAABB

              • +

                Type declaration

                • BOX: 4
                • COMPOUND: 8
                • CONVEXPOLYHEDRON: 16
                • CYLINDER: 128
                • HEIGHTFIELD: 32
                • PARTICLE: 64
                • PLANE: 2
                • SPHERE: 1
                • TRIMESH: 256

              Methods

              calculateLocalInertia

              • calculateLocalInertia(mass: number, target: Vec3): Vec3

              calculateWorldAABB

              computeLocalAABB

              • computeLocalAABB(aabb: AABB): void

              computeLocalAABB

              • computeLocalAABB(aabb: AABB): void

              getEdgeVector

              • getEdgeVector(edgeIndex: number, vectorStore: Vec3): void

              getEdgeVector

              • getEdgeVector(edgeIndex: number, vectorStore: Vec3): void

              getEdgeVertex

              • getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void

              getEdgeVertex

              • getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void
              • Get an edge vertex

                Parameters

                • edgeIndex: number
                • firstOrSecond: number

                  0 or 1, depending on which one of the vertices you need.

                • vertexStore: Vec3

                  Where to store the result

                  -

                Returns void

              getNormal

              • getNormal(i: number, target: Vec3): Vec3

              Returns void

              getNormal

              • getNormal(i: number, target: Vec3): Vec3

              getTriangleVertices

              • getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void

              getTriangleVertices

              • getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void

              getTrianglesInAABB

              • getTrianglesInAABB(aabb: AABB, result: number[]): number[]

              getTrianglesInAABB

              • getTrianglesInAABB(aabb: AABB, result: number[]): number[]
              • Get triangles in a local AABB from the trimesh.

                Parameters

                • aabb: AABB
                • result: number[]

                  An array of integers, referencing the queried triangles.

                  -

                Returns number[]

              getVertex

              Returns number[]

              getVertex

              getWorldVertex

              getWorldVertex

              setScale

              • setScale(scale: Vec3): void

              setScale

              • setScale(scale: Vec3): void

              updateAABB

              • updateAABB(): void

              updateAABB

              • updateAABB(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateBoundingSphereRadius

              • updateBoundingSphereRadius(): void

              updateEdges

              • updateEdges(): void

              updateEdges

              • updateEdges(): void

              updateNormals

              • updateNormals(): void

              updateNormals

              • updateNormals(): void
              • Compute the normals of the faces. Will save in the .normals array.

                -

                Returns void

              updateTree

              • updateTree(): void

              updateTree

              • updateTree(): void

              volume

              • volume(): number

              volume

              • volume(): number

              Static computeNormal

              Static computeNormal

              Static createTorus

              • createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh

              Static createTorus

              • createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh
              • Create a Trimesh instance, shaped as a torus.

                Parameters

                • radius: number = 1
                • tube: number = 0.5
                • radialSegments: number = 8
                • tubularSegments: number = 6
                • arc: number = ...

                Returns Trimesh

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file diff --git a/docs/classes/Vec3.html b/docs/classes/Vec3.html index 8312f3d7..7f56f76b 100644 --- a/docs/classes/Vec3.html +++ b/docs/classes/Vec3.html @@ -2,80 +2,80 @@

              3-dimensional vector

              example
              const v = new Vec3(1, 2, 3)
              console.log('x=' + v.x) // x=1
              -

              Hierarchy

              • Vec3

              Index

              Constructors

              constructor

              • new Vec3(x?: number, y?: number, z?: number): Vec3

              Methods

              addScaledVector

              • addScaledVector(scalar: number, vector: Vec3, target?: Vec3): Vec3

              Hierarchy

              • Vec3

              Index

              Constructors

              constructor

              • new Vec3(x?: number, y?: number, z?: number): Vec3

              Methods

              addScaledVector

              • addScaledVector(scalar: number, vector: Vec3, target?: Vec3): Vec3
              • Scale a vector and add it to this vector. Save the result in "target". (target = this + vector * scalar)

                Parameters

                • scalar: number
                • vector: Vec3
                • target: Vec3 = ...

                  The vector to save the result in.

                  -

                Returns Vec3

              almostEquals

              • almostEquals(vector: Vec3, precision?: number): boolean

              Returns Vec3

              almostEquals

              • almostEquals(vector: Vec3, precision?: number): boolean
              • Check if a vector equals is almost equal to another one.

                -

                Parameters

                • vector: Vec3
                • precision: number = 1e-6

                Returns boolean

              almostZero

              • almostZero(precision?: number): boolean

              almostZero

              • almostZero(precision?: number): boolean
              • Check if a vector is almost zero

                -

                Parameters

                • precision: number = 1e-6

                Returns boolean

              clone

              clone

              copy

              copy

              cross

              cross

              crossmat

              Returns Vec3

              crossmat

              distanceSquared

              • distanceSquared(p: Vec3): number

              distanceSquared

              • distanceSquared(p: Vec3): number
              • Get squared distance from this point to another point

                -

                Parameters

                Returns number

              distanceTo

              • distanceTo(p: Vec3): number

              distanceTo

              • distanceTo(p: Vec3): number
              • Get distance from this point to another point

                -

                Parameters

                Returns number

              dot

              • dot(vector: Vec3): number

              dot

              • dot(vector: Vec3): number

              isAntiparallelTo

              • isAntiparallelTo(vector: Vec3, precision?: number): boolean

              Returns number

              isAntiparallelTo

              • isAntiparallelTo(vector: Vec3, precision?: number): boolean
              • Check if the vector is anti-parallel to another vector.

                Parameters

                • vector: Vec3
                • Optional precision: number

                  Set to zero for exact comparisons

                  -

                Returns boolean

              length

              • length(): number

              Returns boolean

              length

              • length(): number

              lengthSquared

              • lengthSquared(): number

              lengthSquared

              • lengthSquared(): number
              • Get the squared length of the vector.

                -

                Returns number

              lerp

              • lerp(vector: Vec3, t: number, target: Vec3): void

              lerp

              • lerp(vector: Vec3, t: number, target: Vec3): void
              • Do a linear interpolation between two vectors

                Parameters

                • vector: Vec3
                • t: number

                  A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them.

                  -
                • target: Vec3

                Returns void

              negate

              Returns void

              negate

              • Make the vector point in the opposite direction.

                Parameters

                • target: Vec3 = ...

                  Optional target to save in

                  -

                Returns Vec3

              normalize

              • normalize(): number

              Returns Vec3

              normalize

              • normalize(): number
              • Normalize the vector. Note that this changes the values in the vector.

                Returns number

                Returns the norm of the vector

                -

              scale

              • scale(scalar: number, target?: Vec3): Vec3

              scale

              • scale(scalar: number, target?: Vec3): Vec3
              • Multiply all the components of the vector with a scalar.

                Parameters

                • scalar: number
                • target: Vec3 = ...

                  The vector to save the result in.

                  -

                Returns Vec3

              set

              • set(x: number, y: number, z: number): Vec3

              Returns Vec3

              set

              • set(x: number, y: number, z: number): Vec3
              • Set the vectors' 3 elements

                -

                Parameters

                • x: number
                • y: number
                • z: number

                Returns Vec3

              setZero

              • setZero(): void

              setZero

              • setZero(): void
              • Set all components of the vector to zero.

                -

                Returns void

              tangents

              tangents

              • Compute two artificial tangents to the vector

                Parameters

                • t1: Vec3

                  Vector object to save the first tangent in

                • t2: Vec3

                  Vector object to save the second tangent in

                  -

                Returns void

              toArray

              • toArray(): [number, number, number]

              Returns void

              toArray

              • toArray(): [number, number, number]
              • Converts to an array

                -

                Returns [number, number, number]

              toString

              • toString(): string

              toString

              • toString(): string

              unit

              unit

              • Get the version of this vector that is of length 1.

                Parameters

                • target: Vec3 = ...

                  Optional target to save in

                Returns Vec3

                Returns the unit vector

                -

              vadd

              vadd

              vmul

              vmul

              • Multiply the vector with an other vector, component-wise.

                Parameters

                • vector: Vec3
                • target: Vec3 = ...

                  The vector to save the result in.

                  -

                Returns Vec3

              vsub

              Returns Vec3

              vsub

              Legend

              • Constructor
              • Property
              • Method
              • Inherited constructor
              • Inherited property
              • Inherited method
              • Static property
              • Static method

              Settings

              Theme

              \ No newline at end of file +

              Parameters

              Returns Vec3

            • Parameters

              Returns void

            • \ No newline at end of file diff --git a/docs/classes/Vec3Pool.html b/docs/classes/Vec3Pool.html index 5ce9221e..181e0df8 100644 --- a/docs/classes/Vec3Pool.html +++ b/docs/classes/Vec3Pool.html @@ -1,13 +1,13 @@ Vec3Pool | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class Vec3Pool

              Vec3Pool

              -

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              objects

              objects: any[] = []
              +

              Hierarchy

              Index

              Constructors

              constructor

              Properties

              objects

              objects: any[] = []

              The objects array.

              -

              type

              type: typeof Vec3 = Vec3
              +

              type

              type: typeof Vec3 = Vec3

              The type of the objects.

              -

              Methods

              constructObject

              • constructObject(): Vec3

              Methods

              constructObject

              • constructObject(): Vec3

              get

              • get(): any

              get

              • get(): any

              release

              • release(...args: any[]): Pool

              release

              • release(...args: any[]): Pool
              \ No newline at end of file diff --git a/docs/classes/WheelInfo.html b/docs/classes/WheelInfo.html index de0ebdc7..d81492d7 100644 --- a/docs/classes/WheelInfo.html +++ b/docs/classes/WheelInfo.html @@ -1,6 +1,6 @@ WheelInfo | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class WheelInfo

              WheelInfo

              -

              Hierarchy

              • WheelInfo

              Index

              Constructors

              constructor

              • new WheelInfo(options?: { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean }): WheelInfo
              • Parameters

                • options: { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean } = {}
                  • Optional axleLocal?: Vec3
                    +

              Hierarchy

              • WheelInfo

              Index

              Constructors

              constructor

              • new WheelInfo(options?: { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean }): WheelInfo
              • Parameters

                • options: { axleLocal?: Vec3; axleWorld?: Vec3; chassisConnectionPointLocal?: Vec3; chassisConnectionPointWorld?: Vec3; clippedInvContactDotSuspension?: number; customSlidingRotationalSpeed?: number; dampingCompression?: number; dampingRelaxation?: number; deltaRotation?: number; directionLocal?: Vec3; directionWorld?: Vec3; forwardAcceleration?: number; frictionSlip?: number; isFrontWheel?: boolean; maxSuspensionForce?: number; maxSuspensionTravel?: number; radius?: number; rollInfluence?: number; rotation?: number; sideAcceleration?: number; skidInfo?: number; slipInfo?: number; steering?: number; suspensionForce?: number; suspensionLength?: number; suspensionMaxLength?: number; suspensionRelativeVelocity?: number; suspensionRestLength?: number; suspensionStiffness?: number; useCustomSlidingRotationalSpeed?: boolean } = {}
                  • Optional axleLocal?: Vec3

                    axleLocal

                  • Optional axleWorld?: Vec3

                    axleWorld

                    @@ -80,100 +80,100 @@
                  • Optional useCustomSlidingRotationalSpeed?: boolean

                    If the customSlidingRotationalSpeed should be used.

                    default

                    false

                    -

                Returns WheelInfo

              Properties

              axleLocal

              axleLocal: Vec3
              +

              Returns WheelInfo

              Properties

              axleLocal

              axleLocal: Vec3

              axleLocal

              -

              axleWorld

              axleWorld: Vec3
              +

              axleWorld

              axleWorld: Vec3

              axleWorld

              -

              brake

              brake: number
              +

              brake

              brake: number

              brake

              -

              chassisConnectionPointLocal

              chassisConnectionPointLocal: Vec3
              +

              chassisConnectionPointLocal

              chassisConnectionPointLocal: Vec3

              Connection point, defined locally in the chassis body frame.

              -

              chassisConnectionPointWorld

              chassisConnectionPointWorld: Vec3
              +

              chassisConnectionPointWorld

              chassisConnectionPointWorld: Vec3

              chassisConnectionPointWorld

              -

              clippedInvContactDotSuspension

              clippedInvContactDotSuspension: number
              +

              clippedInvContactDotSuspension

              clippedInvContactDotSuspension: number

              clippedInvContactDotSuspension

              default

              1

              -

              customSlidingRotationalSpeed

              customSlidingRotationalSpeed: number
              +

              customSlidingRotationalSpeed

              customSlidingRotationalSpeed: number

              Speed to apply to the wheel rotation when the wheel is sliding.

              default

              -0.1

              -

              dampingCompression

              dampingCompression: number
              +

              dampingCompression

              dampingCompression: number

              dampingCompression

              default

              10

              -

              dampingRelaxation

              dampingRelaxation: number
              +

              dampingRelaxation

              dampingRelaxation: number

              dampingRelaxation

              default

              10

              -

              deltaRotation

              deltaRotation: number
              +

              deltaRotation

              deltaRotation: number

              deltaRotation

              default

              0

              -

              directionLocal

              directionLocal: Vec3
              +

              directionLocal

              directionLocal: Vec3

              directionLocal

              -

              directionWorld

              directionWorld: Vec3
              +

              directionWorld

              directionWorld: Vec3

              directionWorld

              -

              engineForce

              engineForce: number
              +

              engineForce

              engineForce: number

              engineForce

              -

              forwardAcceleration

              forwardAcceleration: number
              +

              forwardAcceleration

              forwardAcceleration: number

              forwardAcceleration

              -

              forwardImpulse

              forwardImpulse: number
              +

              forwardImpulse

              forwardImpulse: number

              forwardImpulse

              -

              frictionSlip

              frictionSlip: number
              +

              frictionSlip

              frictionSlip: number

              frictionSlip

              default

              10.5

              -

              isFrontWheel

              isFrontWheel: boolean
              +

              isFrontWheel

              isFrontWheel: boolean

              isFrontWheel

              default

              true

              -

              isInContact

              isInContact: boolean
              +

              isInContact

              isInContact: boolean

              isInContact

              -

              maxSuspensionForce

              maxSuspensionForce: number
              +

              maxSuspensionForce

              maxSuspensionForce: number

              maxSuspensionForce

              -

              maxSuspensionTravel

              maxSuspensionTravel: number
              +

              maxSuspensionTravel

              maxSuspensionTravel: number

              Max travel distance of the suspension, in meters.

              default

              1

              -

              radius

              radius: number
              +

              radius

              radius: number

              radius

              default

              1

              -

              raycastResult

              raycastResult: WheelRaycastResult
              +

              raycastResult

              raycastResult: WheelRaycastResult

              The result from raycasting.

              -

              rollInfluence

              rollInfluence: number
              +

              rollInfluence

              rollInfluence: number

              rollInfluence

              default

              0.01

              -

              rotation

              rotation: number
              +

              rotation

              rotation: number

              Rotation value, in radians.

              default

              0

              -

              sideAcceleration

              sideAcceleration: number
              +

              sideAcceleration

              sideAcceleration: number

              sideAcceleration

              -

              sideImpulse

              sideImpulse: number
              +

              sideImpulse

              sideImpulse: number

              sideImpulse

              -

              skidInfo

              skidInfo: number
              +

              skidInfo

              skidInfo: number

              skidInfo

              default

              0

              -

              sliding

              sliding: boolean
              +

              sliding

              sliding: boolean

              sliding

              -

              slipInfo

              slipInfo: number
              +

              slipInfo

              slipInfo: number

              slipInfo

              -

              steering

              steering: number
              +

              steering

              steering: number

              steering

              default

              0

              -

              suspensionForce

              suspensionForce: number
              +

              suspensionForce

              suspensionForce: number

              suspensionForce

              default

              0

              -

              suspensionLength

              suspensionLength: number
              +

              suspensionLength

              suspensionLength: number

              suspensionLength

              default

              0

              -

              suspensionMaxLength

              suspensionMaxLength: number
              +

              suspensionMaxLength

              suspensionMaxLength: number

              suspensionMaxLength

              default

              2

              -

              suspensionRelativeVelocity

              suspensionRelativeVelocity: number
              +

              suspensionRelativeVelocity

              suspensionRelativeVelocity: number

              suspensionRelativeVelocity

              default

              0

              -

              suspensionRestLength

              suspensionRestLength: number
              +

              suspensionRestLength

              suspensionRestLength: number

              suspensionRestLength

              default

              1

              -

              suspensionStiffness

              suspensionStiffness: number
              +

              suspensionStiffness

              suspensionStiffness: number

              suspensionStiffness

              default

              100

              -

              useCustomSlidingRotationalSpeed

              useCustomSlidingRotationalSpeed: boolean
              +

              useCustomSlidingRotationalSpeed

              useCustomSlidingRotationalSpeed: boolean

              If the customSlidingRotationalSpeed should be used.

              default

              false

              -

              worldTransform

              worldTransform: Transform
              +

              worldTransform

              worldTransform: Transform

              Wheel world transform.

              \ No newline at end of file diff --git a/docs/classes/World.html b/docs/classes/World.html index 9b44797b..53ebbba2 100644 --- a/docs/classes/World.html +++ b/docs/classes/World.html @@ -1,6 +1,6 @@ World | cannon-es
              Options
              All
              • Public
              • Public/Protected
              • All
              Menu

              Class World

              The physics world

              -

              Hierarchy

              Index

              Constructors

              constructor

              • new World(options?: { allowSleep?: boolean; broadphase?: Broadphase; frictionGravity?: Vec3; gravity?: Vec3; quatNormalizeFast?: boolean; quatNormalizeSkip?: number; solver?: Solver }): World

              Hierarchy

              Index

              Constructors

              constructor

              • new World(options?: { allowSleep?: boolean; broadphase?: Broadphase; frictionGravity?: Vec3; gravity?: Vec3; quatNormalizeFast?: boolean; quatNormalizeSkip?: number; solver?: Solver }): World
              • Parameters

                • options: { allowSleep?: boolean; broadphase?: Broadphase; frictionGravity?: Vec3; gravity?: Vec3; quatNormalizeFast?: boolean; quatNormalizeSkip?: number; solver?: Solver } = {}
                  • Optional allowSleep?: boolean

                    Makes bodies go to sleep when they've been inactive.

                    default

                    false

                  • Optional broadphase?: Broadphase
                    @@ -21,80 +21,80 @@
                  • Optional solver?: Solver

                    The solver algorithm to use.

                    default

                    GSSolver

                    -

                Returns World

              Properties

              accumulator

              accumulator: number
              +

              Returns World

              Properties

              accumulator

              accumulator: number

              Time accumulator for interpolation.

              see

              https://gafferongames.com/game-physics/fix-your-timestep/

              -

              addBodyEvent

              addBodyEvent: {}
              +

              addBodyEvent

              addBodyEvent: {}

              Dispatched after a body has been added to the world.

              -

              Type declaration

                allowSleep

                allowSleep: boolean
                +

                Type declaration

                  allowSleep

                  allowSleep: boolean

                  Makes bodies go to sleep when they've been inactive.

                  default

                  false

                  -

                  bodies

                  bodies: Body[]
                  +

                  bodies

                  bodies: Body[]

                  All bodies in this world

                  -

                  broadphase

                  broadphase: Broadphase
                  +

                  broadphase

                  broadphase: Broadphase

                  The broadphase algorithm to use.

                  default

                  NaiveBroadphase

                  -

                  collisionMatrix

                  collisionMatrix: ArrayCollisionMatrix
                  +

                  collisionMatrix

                  collisionMatrix: ArrayCollisionMatrix

                  collisionMatrix

                  -

                  collisionMatrixPrevious

                  collisionMatrixPrevious: ArrayCollisionMatrix
                  +

                  collisionMatrixPrevious

                  collisionMatrixPrevious: ArrayCollisionMatrix

                  CollisionMatrix from the previous step.

                  -

                  contactMaterialTable

                  contactMaterialTable: TupleDictionary
                  +

                  contactMaterialTable

                  contactMaterialTable: TupleDictionary

                  Used to look up a ContactMaterial given two instances of Material.

                  -

                  contactmaterials

                  contactmaterials: ContactMaterial[]
                  +

                  contactmaterials

                  contactmaterials: ContactMaterial[]

                  All added contactmaterials.

                  -

                  contacts

                  contacts: ContactEquation[]
                  +

                  contacts

                  contacts: ContactEquation[]

                  All the current contacts (instances of ContactEquation) in the world.

                  -

                  defaultContactMaterial

                  defaultContactMaterial: ContactMaterial
                  +

                  defaultContactMaterial

                  defaultContactMaterial: ContactMaterial

                  This contact material is used if no suitable contactmaterial is found for a contact.

                  -

                  defaultMaterial

                  defaultMaterial: Material
                  +

                  defaultMaterial

                  defaultMaterial: Material

                  The default material of the bodies.

                  -

                  default_dt

                  default_dt: number
                  +

                  default_dt

                  default_dt: number

                  Default and last timestep sizes.

                  -

                  dt

                  dt: number
                  +

                  dt

                  dt: number

                  Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is "fresh" inside event callbacks.

                  -

                  Optional frictionGravity

                  frictionGravity?: Vec3
                  -

                  Gravity to use when approximating the friction max force (mumassgravity). +

                  Optional frictionGravity

                  frictionGravity?: Vec3
                  +

                  Gravity to use when approximating the friction max force (mu * mass * gravity). If undefined, global gravity will be used. Use to enable friction in a World with a null gravity vector (no gravity).

                  -

                  gravity

                  gravity: Vec3
                  +

                  gravity

                  gravity: Vec3

                  The gravity of the world.

                  -

                  hasActiveBodies

                  hasActiveBodies: boolean
                  +

                  hasActiveBodies

                  hasActiveBodies: boolean

                  True if any bodies are not sleeping, false if every body is sleeping.

                  -

                  quatNormalizeFast

                  quatNormalizeFast: boolean
                  +

                  quatNormalizeFast

                  quatNormalizeFast: boolean

                  Set to true to use fast quaternion normalization. It is often enough accurate to use. If bodies tend to explode, set to false.

                  default

                  false

                  -

                  quatNormalizeSkip

                  quatNormalizeSkip: number
                  +

                  quatNormalizeSkip

                  quatNormalizeSkip: number

                  How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong).

                  default

                  0

                  -

                  removeBodyEvent

                  removeBodyEvent: {}
                  +

                  removeBodyEvent

                  removeBodyEvent: {}

                  Dispatched after a body has been removed from the world.

                  -

                  Type declaration

                    solver

                    solver: Solver
                    +

                    Type declaration

                      solver

                      solver: Solver

                      The solver algorithm to use.

                      default

                      GSSolver

                      -

                      stepnumber

                      stepnumber: number
                      +

                      stepnumber

                      stepnumber: number

                      Number of timesteps taken since start.

                      -

                      time

                      time: number
                      +

                      time

                      time: number

                      The wall-clock time since simulation start.

                      -

                      Methods

                      addBody

                      • addBody(body: Body): void

                      Methods

                      addBody

                      • addBody(body: Body): void
                      • Add a rigid body to the simulation.

                        todo

                        If the simulation has not yet started, why recrete and copy arrays for each body? Accumulate in dynamic arrays in this case.

                        todo

                        Adding an array of bodies should be possible. This would save some loops too

                        -

                        Parameters

                        Returns void

                      addConstraint

                      addConstraint

                      addContactMaterial

                      addContactMaterial

                      addEventListener

                      • addEventListener(type: string, listener: Function): EventTarget

                      addEventListener

                      • addEventListener(type: string, listener: Function): EventTarget

                      clearForces

                      • clearForces(): void

                      clearForces

                      • clearForces(): void

                      collisionMatrixTick

                      • collisionMatrixTick(): void

                      collisionMatrixTick

                      • collisionMatrixTick(): void

                      dispatchEvent

                      dispatchEvent

                      fixedStep

                      • fixedStep(dt?: number, maxSubSteps?: number): void

                      fixedStep

                      • fixedStep(dt?: number, maxSubSteps?: number): void
                    • maxSubSteps: number = 10

                      Maximum number of fixed steps to take per function call (default: 10).

                      -
                    • Returns void

                      getContactMaterial

                      Returns void

                      getContactMaterial

                      hasAnyEventListener

                      hasAnyEventListener

                      hasEventListener

                      hasEventListener

                      rayTest

                      rayTest

                      raycastAll

                      raycastAll

                      raycastAny

                      raycastAny

                      raycastClosest

                      raycastClosest

                      removeBody

                      removeBody

                      removeConstraint

                      removeConstraint

                      removeContactMaterial

                      removeContactMaterial

                      removeEventListener

                      removeEventListener

                      step

                      step

                      ShapeType

                      ShapeType: typeof SHAPE_TYPES[keyof typeof SHAPE_TYPES]

                      ShapeType

                      -

                      Variables

                      BODY_SLEEP_STATES

                      BODY_SLEEP_STATES: { AWAKE: 0; SLEEPING: 2; SLEEPY: 1 } = ...
                      +

                      Variables

                      BODY_SLEEP_STATES

                      BODY_SLEEP_STATES: { AWAKE: 0; SLEEPING: 2; SLEEPY: 1 } = ...

                      BODY_SLEEP_STATES

                      -

                      Type declaration

                      • AWAKE: 0
                      • SLEEPING: 2
                      • SLEEPY: 1

                      BODY_TYPES

                      BODY_TYPES: { DYNAMIC: 1; KINEMATIC: 4; STATIC: 2 } = ...
                      +

                      Type declaration

                      • AWAKE: 0
                      • SLEEPING: 2
                      • SLEEPY: 1

                      BODY_TYPES

                      BODY_TYPES: { DYNAMIC: 1; KINEMATIC: 4; STATIC: 2 } = ...

                      BODY_TYPES

                      -

                      Type declaration

                      • DYNAMIC: 1
                      • KINEMATIC: 4
                      • STATIC: 2

                      RAY_MODES

                      RAY_MODES: { ALL: 4; ANY: 2; CLOSEST: 1 } = ...
                      +

                      Type declaration

                      • DYNAMIC: 1
                      • KINEMATIC: 4
                      • STATIC: 2

                      RAY_MODES

                      RAY_MODES: { ALL: 4; ANY: 2; CLOSEST: 1 } = ...

                      RAY_MODES

                      -

                      Type declaration

                      • ALL: 4
                      • ANY: 2
                      • CLOSEST: 1

                      SHAPE_TYPES

                      SHAPE_TYPES: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = ...
                      +

                      Type declaration

                      • ALL: 4
                      • ANY: 2
                      • CLOSEST: 1

                      SHAPE_TYPES

                      SHAPE_TYPES: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = ...

                      The available shape types.

                      Type declaration

                      • BOX: 4
                      • COMPOUND: 8
                      • CONVEXPOLYHEDRON: 16
                      • CYLINDER: 128
                      • HEIGHTFIELD: 32
                      • PARTICLE: 64
                      • PLANE: 2
                      • SPHERE: 1
                      • TRIMESH: 256
                      \ No newline at end of file