Optional
shape: ShapePrivate
_parentPrivate
_shapePrivate
colliderPrivate
ensureReadonly
handleGets the collision types active for this collider.
The events active for this collider.
Get the physics hooks active for this collider.
Find the closest intersection between a ray and this collider.
This also computes the normal at the hit point.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
If false
then the ray will attempt to hit the boundary of a shape, even if its
origin already lies inside of a shape. In other terms, true
implies that all shapes are plain,
whereas false
implies that all shapes are hollow for this ray-cast.
The time-of-impact between this collider and the ray, or -1
if there is no intersection.
Find the closest intersection between a ray and this collider.
This also computes the normal at the hit point.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
If false
then the ray will attempt to hit the boundary of a shape, even if its
origin already lies inside of a shape. In other terms, true
implies that all shapes are plain,
whereas false
implies that all shapes are hollow for this ray-cast.
Set the internal cached JS shape to null.
This can be useful if you want to free some memory (assuming you are not
holding any other references to the shape object), or in order to force
the recalculation of the JS shape (the next time the shape
getter is
accessed) from the WASM source of truth.
If this and voxels2
are voxel colliders, this will ensure that a
moving object transitioning across the boundaries of these colliders
won’t suffer from the "internal edges" artifact.
If the voxels in voxels2
live in a different coordinate space from this
,
then the shift_*
argument indicate the distance, in voxel units, between
the origin of this
to the origin of voxels2
.
This method is intended to be called once between all pairs of voxels colliders with intersecting domains or shared boundaries.
If either voxels collider is then modified with setVoxel
, the
propagateVoxelChange
method must be called to maintain the coupling
between the voxels shapes after the modification.
Computes one pair of contact points between the collider and the given collider.
The second collider.
The prediction value, if the shapes are separated by a distance greater than this value, test will fail.
null
if the shapes are separated by a distance greater than prediction, otherwise contact details. The result is given in world-space.
Computes one pair of contact points between the shape owned by this collider and the given shape.
null
if the shapes are separated by a distance greater than prediction, otherwise contact details. The result is given in world-space.
Tests if this collider contains a point.
The point to test.
Internal
Gets the rule used to combine the friction coefficients of two colliders colliders involved in a contact.
Tests if this collider intersects the given ray.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
Find the projection of a point on this collider.
The point to project.
If this is set to true
then the collider shapes are considered to
be plain (if the point is located inside of a plain shape, its projection is the point
itself). If it is set to false
the collider shapes are considered to be hollow
(if the point is located inside of an hollow shape, it is projected on the shape's
boundary).
If this and voxels2
are voxel colliders, and a voxel from this
was
modified with setVoxel
, this will ensure that a
moving object transitioning across the boundaries of these colliders
won’t suffer from the "internal edges" artifact.
The indices ix, iy, iz
indicate the integer coordinates of the voxel in
the local coordinate frame of this
.
If the voxels in voxels2
live in a different coordinate space from this
,
then the shift_*
argument indicate the distance, in voxel units, between
the origin of this
to the origin of voxels2
.
This method is intended to be called between this
and all the other
voxels colliders with a domain intersecting this
or sharing a domain
boundary. This is an incremental maintenance of the effect of
combineVoxelStates
.
Gets the rule used to combine the restitution coefficients of two colliders colliders involved in a contact.
Set the collision types active for this collider.
The hooks active for contact/intersection pairs involving this collider.
Set the events active for this collider.
Use this to enable contact and/or intersection event reporting for this collider.
The events active for contact/intersection pairs involving this collider.
Set the physics hooks active for this collider.
Use this to enable custom filtering rules for contact/intersecstion pairs involving this collider.
The hooks active for contact/intersection pairs involving this collider.
Sets the collision groups used by this collider.
Two colliders will interact iff. their collision groups are compatible.
See the documentation of InteractionGroups
for details on teh used bit pattern.
The collision groups used for the collider being built.
Sets the uniform density of this collider.
This will override any previous mass-properties set by this.setDensity
,
this.setMass
, this.setMassProperties
, ColliderDesc.density
,
ColliderDesc.mass
, or ColliderDesc.massProperties
for this collider.
The mass and angular inertia of this collider will be computed automatically based on its shape.
Sets the friction coefficient of the collider to be created.
The friction coefficient. Must be greater or equal to 0. This is generally smaller than 1. The higher the coefficient, the stronger friction forces will be for contacts with the collider being built.
Sets the rule used to combine the friction coefficients of two colliders colliders involved in a contact.
− The combine rule to apply.
Sets the half-extents of this collider if it is a cuboid shape.
desired half extents.
Sets the mass of this collider.
This will override any previous mass-properties set by this.setDensity
,
this.setMass
, this.setMassProperties
, ColliderDesc.density
,
ColliderDesc.mass
, or ColliderDesc.massProperties
for this collider.
The angular inertia of this collider will be computed automatically based on its shape and this mass value.
Sets the mass of this collider.
This will override any previous mass-properties set by this.setDensity
,
this.setMass
, this.setMassProperties
, ColliderDesc.density
,
ColliderDesc.mass
, or ColliderDesc.massProperties
for this collider.
Sets the restitution coefficient of the collider to be created.
The restitution coefficient in [0, 1]
. A value of 0 (the default) means no bouncing behavior
while 1 means perfect bouncing (though energy may still be lost due to numerical errors of the
constraints solver).
Sets the rule used to combine the restitution coefficients of two colliders colliders involved in a contact.
− The combine rule to apply.
Sets the rotation quaternion of this collider.
This does nothing if a zero quaternion is provided.
Sets the rotation quaternion of this collider relative to its parent rigid-body.
This does nothing if a zero quaternion is provided or if this collider isn't attached to a rigid-body.
Sets the new shape of the collider.
The collider’s new shape.
Sets the solver groups used by this collider.
Forces between two colliders in contact will be computed iff their solver
groups are compatible.
See the documentation of InteractionGroups
for details on the used bit pattern.
The solver groups used for the collider being built.
Sets the translation of this collider.
The world-space position of the collider.
Sets the translation of this collider relative to its parent rigid-body.
Does nothing if this collider isn't attached to a rigid-body.
The new translation of the collider relative to its parent.
If this collider has a Voxels shape, this will mark the voxel at the
given grid coordinates as filled or empty (depending on the filled
argument).
Each input value is assumed to be an integer.
The operation is O(1), unless the provided coordinates are out of the bounds of the currently allocated internal grid in which case the grid will be grown automatically.
A geometric entity that can be attached to a body so it can be affected by contacts and proximity queries.