5.1 KiB
Class: EdgeShape
A line segment (edge) shape. These can be connected in chains or loops to other edge shapes. The connectivity information is used to ensure correct contact normals.
Extends
Constructors
new EdgeShape()
new EdgeShape(
v1?,v2?):EdgeShape
Parameters
• v1?: Vec2Value
• v2?: Vec2Value
Returns
Overrides
Properties
style
style:
Style={}
Styling for dev-tools.
Inherited from
TYPE
staticTYPE:"edge"
Methods
_set()
_set(
v1,v2):EdgeShape
Set this as an isolated edge.
Parameters
• v1: Vec2Value
• v2: Vec2Value
Returns
computeAABB()
computeAABB(
aabb,xf,childIndex):void
Given a transform, compute the associated axis aligned bounding box for a child shape.
Parameters
• aabb: AABBValue
Returns the axis aligned box.
• xf: TransformValue
The world transform of the shape.
• childIndex: number
The child shape
Returns
void
Overrides
computeDistanceProxy()
computeDistanceProxy(
proxy):void
Parameters
• proxy: DistanceProxy
Returns
void
Overrides
computeMass()
computeMass(
massData,density?):void
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.
Parameters
• massData: MassData
Returns the mass data for this shape.
• density?: number
The density in kilograms per meter squared.
Returns
void
Overrides
getChildCount()
getChildCount():
1
Get the number of child primitives.
Returns
1
Overrides
getNextVertex()
getNextVertex():
Vec2
Optional next vertex, used for smooth collision.
Returns
getPrevVertex()
getPrevVertex():
Vec2
Optional prev vertex, used for smooth collision.
Returns
getRadius()
getRadius():
number
Returns
number
Overrides
getType()
getType():
"edge"
Get the type of this shape. You can use this to down cast to the concrete shape.
Returns
"edge"
the shape type.
Overrides
rayCast()
rayCast(
output,input,xf,childIndex):boolean
Cast a ray against a child shape.
Parameters
• output: RayCastOutput
The ray-cast results.
• input: RayCastInput
The ray-cast input parameters.
• xf: Transform
The transform to be applied to the shape.
• childIndex: number
The child shape index
Returns
boolean
Overrides
setNextVertex()
setNextVertex(
v?):EdgeShape
Optional next vertex, used for smooth collision.
Parameters
• v?: Vec2Value
Returns
setPrevVertex()
setPrevVertex(
v?):EdgeShape
Optional prev vertex, used for smooth collision.
Parameters
• v?: Vec2Value
Returns
testPoint()
testPoint(
xf,p):false
Test a point for containment in this shape. This only works for convex shapes.
Parameters
• xf: TransformValue
The shape world transform.
• p: Vec2Value
A point in world coordinates.
Returns
false
Overrides
isValid()
staticisValid(obj):boolean
Parameters
• obj: any
Returns
boolean