Narrowphase Class
Narrowphase. Creates contacts and friction given shapes and transforms.
Constructor
Narrowphase
()
Item Index
Methods
- capsuleCapsule
- capsulePlane deprecated
- circleCapsule
- circleCircle
- circleConvex
- circleHeightfield
- circleLine
- circleParticle
- circlePlane
- collidedLastStep
- convexCapsule
- convexConvex
- convexLine
- convexPlane deprecated
- createContactEquation
- createFrictionEquation
- createFrictionFromContact
- findSeparatingAxis static
- getClosestEdge static
- lineCapsule
- lineLine
- lineRectangle
- particleConvex
- particlePlane
- planeConvex
- planeLine
- projectConvexOntoAxis static
- reset
Methods
capsuleCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Capsule/capsule narrowphase
capsulePlane
()
deprecated
circleCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Circle/capsule Narrowphase
circleCircle
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Circle/circle Narrowphase
circleConvex
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Circle/convex Narrowphase
circleHeightfield
-
bi
-
si
-
xi
-
bj
-
sj
-
xj
-
aj
Parameters:
-
bi
Body -
si
Circle -
xi
Array -
bj
Body -
sj
Heightfield -
xj
Array -
aj
Number
circleLine
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
-
justTest
-
lineRadius
-
circleRadius
Circle/line Narrowphase
Parameters:
-
bi
Body -
si
Circle -
xi
Array -
ai
Number -
bj
Body -
sj
Line -
xj
Array -
aj
Number -
justTest
BooleanIf set to true, this function will return the result (intersection or not) without adding equations.
-
lineRadius
NumberRadius to add to the line. Can be used to test Capsules.
-
circleRadius
NumberIf set, this value overrides the circle shape radius.
circleParticle
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Circle/Particle Narrowphase
circlePlane
-
bi
-
si
-
xi
-
bj
-
sj
-
xj
-
aj
Creates ContactEquations and FrictionEquations for a collision.
Parameters:
-
bi
BodyThe first body that should be connected to the equations.
-
si
CircleThe circle shape participating in the collision.
-
xi
ArrayExtra offset to take into account for the Shape, in addition to the one in circleBody.position. Will not be rotated by circleBody.angle (maybe it should, for sake of homogenity?). Set to null if none.
-
bj
BodyThe second body that should be connected to the equations.
-
sj
PlaneThe Plane shape that is participating
-
xj
ArrayExtra offset for the plane shape.
-
aj
NumberExtra angle to apply to the plane
collidedLastStep
-
bi
-
bj
Check if the bodies were in contact since the last reset().
Returns:
convexCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Convex/capsule narrowphase
convexLine
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Convex/line narrowphase
convexPlane
()
deprecated
createContactEquation
-
bodyA
-
bodyB
Creates a ContactEquation, either by reusing an existing object or creating a new one.
Returns:
createFrictionEquation
-
bodyA
-
bodyB
Creates a FrictionEquation, either by reusing an existing object or creating a new one.
Returns:
createFrictionFromContact
-
contactEquation
Creates a FrictionEquation given the data in the ContactEquation. Uses same offset vectors ri and rj, but the tangent vector will be constructed from the collision normal.
Parameters:
-
contactEquation
ContactEquation
Returns:
findSeparatingAxis
-
c1
-
offset1
-
angle1
-
c2
-
offset2
-
angle2
-
sepAxis
Find a separating axis between the shapes, that maximizes the separating distance between them.
Parameters:
Returns:
Whether the axis could be found.
getClosestEdge
-
c
-
angle
-
axis
-
flip
Get the edge that has a normal closest to an axis.
Parameters:
-
c
Convex -
angle
Number -
axis
Array -
flip
Boolean
Returns:
Index of the edge that is closest. This index and the next spans the resulting edge. Returns -1 if failed.
lineCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Capsule/line narrowphase
lineLine
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Line/line narrowphase
lineRectangle
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Line/rectangle narrowphase
particleConvex
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Particle/convex Narrowphase
particlePlane
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Narrowphase for particle vs plane
planeConvex
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Plane/Convex Narrowphase
planeLine
-
planeBody
-
planeShape
-
planeOffset
-
planeAngle
-
lineBody
-
lineShape
-
lineOffset
-
lineAngle
Plane/line Narrowphase
projectConvexOntoAxis
-
convexShape
-
convexOffset
-
convexAngle
-
worldAxis
-
result
Project a Convex onto a world-oriented axis
Parameters:
-
convexShape
Convex -
convexOffset
Array -
convexAngle
Number -
worldAxis
Array -
result
Array
Properties
contactEquations
Array
enableFriction
Boolean
Whether to make friction equations in the upcoming contacts.
frictionCoefficient
Number
The friction value to use in the upcoming friction equations.
frictionEquations
Array
frictionRelaxation
Number
The relaxation value to use in the next friction equations.
frictionStiffness
Number
The stiffness value to use in the next friction equations.
restitution
Number
The restitution value to use in the next contact equations.
slipForce
Number
The friction slip force to use when creating friction equations.
stiffness
Number
The stiffness value to use in the next contact equations.
stiffness
Number
The stiffness value to use in the next contact equations.
surfaceVelocity
Number
Will be the .relativeVelocity in each produced FrictionEquation.