Narrowphase Class
Narrowphase. Creates contacts and friction given shapes and transforms.
Constructor
Narrowphase
()
Item Index
Methods
- bodiesOverlap
- capsuleCapsule
- circleCapsule
- circleCircle
- circleConvex
- circleHeightfield
- circleHeightfield
- circleLine
- circleParticle
- circlePlane
- collidedLastStep
- convexCapsule
- convexConvex
- convexLine
- createContactEquation
- createFrictionEquation
- createFrictionFromContact
- findSeparatingAxis static
- getClosestEdge static
- lineBox
- lineCapsule
- lineLine
- particleConvex
- particlePlane
- planeCapsule
- planeConvex
- planeLine
- projectConvexOntoAxis static
- reset
Properties
Methods
capsuleCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Capsule/capsule narrowphase
circleCapsule
-
bi
-
si
-
xi
-
ai
-
bj
-
sj
-
xj
-
aj
Circle/capsule Narrowphase
circleCircle
-
bodyA
-
shapeA
-
offsetA
-
angleA
-
bodyB
-
shapeB
-
offsetB
-
angleB
-
justTest
-
[radiusA]
-
[radiusB]
Circle/circle Narrowphase
circleConvex
-
circleBody
-
circleShape
-
circleOffset
-
circleAngle
-
convexBody
-
convexShape
-
convexOffset
-
convexAngle
-
justTest
-
circleRadius
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
circleHeightfield
-
bi
-
si
-
xi
-
bj
-
sj
-
xj
-
aj
Parameters:
-
bi
Body -
si
Circle -
xi
Array -
bj
Body -
sj
Heightfield -
xj
Array -
aj
Number
circleLine
-
circleBody
-
circleShape
-
circleOffset
-
circleAngle
-
lineBody
-
lineShape
-
lineOffset
-
lineAngle
-
justTest
-
lineRadius
-
circleRadius
Circle/line Narrowphase
Parameters:
-
circleBody
Body -
circleShape
Circle -
circleOffset
Array -
circleAngle
Number -
lineBody
Body -
lineShape
Line -
lineOffset
Array -
lineAngle
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
-
circleBody
-
circleShape
-
circleOffset
-
circleAngle
-
particleBody
-
particleShape
-
particleOffset
-
particleAngle
-
justTest
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
-
bodyA
-
bodyB
Check if the bodies were in contact since the last reset().
Returns:
convexCapsule
-
convexBody
-
convexShape
-
convexPosition
-
convexAngle
-
capsuleBody
-
capsuleShape
-
capsulePosition
-
capsuleAngle
Convex/capsule narrowphase
convexLine
-
convexBody
-
convexShape
-
convexOffset
-
convexAngle
-
lineBody
-
lineShape
-
lineOffset
-
lineAngle
-
justTest
Convex/line narrowphase
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.
lineBox
-
lineBody
-
lineShape
-
lineOffset
-
lineAngle
-
boxBody
-
boxShape
-
boxOffset
-
boxAngle
-
justTest
Line/box narrowphase
lineCapsule
-
lineBody
-
lineShape
-
linePosition
-
lineAngle
-
capsuleBody
-
capsuleShape
-
capsulePosition
-
capsuleAngle
Capsule/line narrowphase
lineLine
-
bodyA
-
shapeA
-
positionA
-
angleA
-
bodyB
-
shapeB
-
positionB
-
angleB
Line/line narrowphase
particleConvex
-
particleBody
-
particleShape
-
particleOffset
-
particleAngle
-
convexBody
-
convexShape
-
convexOffset
-
convexAngle
-
justTest
Particle/convex Narrowphase
particlePlane
-
particleBody
-
particleShape
-
particleOffset
-
particleAngle
-
planeBody
-
planeShape
-
planeOffset
-
planeAngle
-
justTest
Narrowphase for particle vs plane
planeCapsule
-
planeBody
-
planeShape
-
planeOffset
-
planeAngle
-
capsuleBody
-
capsuleShape
-
capsuleOffset
-
capsuleAngle
-
justTest
planeConvex
-
planeBody
-
planeShape
-
planeOffset
-
planeAngle
-
convexBody
-
convexShape
-
convexOffset
-
convexAngle
-
justTest
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
reset
()
Throws away the old equations and gets ready to create new
Properties
contactEquationPool
ContactEquationPool
Keeps track of the allocated ContactEquations.
Example:
// Allocate a few equations before starting the simulation.
// This way, no contact objects need to be created on the fly in the game loop.
world.narrowphase.contactEquationPool.resize(1024);
world.narrowphase.frictionEquationPool.resize(1024);
contactEquations
Array
contactSkinSize
Number
Contact skin size value to use in the next contact equations.
Default: 0.01
enabledEquations
Boolean
Whether to make equations enabled in upcoming contacts.
enableFriction
Boolean
Whether to make friction equations in the upcoming contacts.
enableFrictionReduction
Boolean
deprecated
Enable reduction of friction equations. If disabled, a box on a plane will generate 2 contact equations and 2 friction equations. If enabled, there will be only one friction equation. Same kind of simplifications are made for all collision types.
Default: true
frictionCoefficient
Number
The friction value to use in the upcoming friction equations.
frictionEquationPool
FrictionEquationPool
Keeps track of the allocated ContactEquations.
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.