Appearance
Class: BoxShape
A rectangle polygon which extend PolygonShape.
Extends
Constructors
Constructor
new BoxShape(
halfWidth,halfHeight,center?,angle?):BoxShape
Parameters
halfWidth
number
halfHeight
number
center?
coordinate of the center of the box relative to the body
angle?
number
angle of the box relative to the body
Returns
BoxShape
Overrides
Properties
style
style:
Style={}
Styling for dev-tools.
Inherited from
TYPE
staticTYPE:"polygon"
Overrides
Methods
computeAABB()
computeAABB(
aabb,xf,childIndex):void
Given a transform, compute the associated axis aligned bounding box for a child shape.
Parameters
aabb
Returns the axis aligned box.
xf
The world transform of the shape.
childIndex
number
The child shape
Returns
void
Inherited from
computeDistanceProxy()
computeDistanceProxy(
proxy):void
Parameters
proxy
Returns
void
Inherited from
PolygonShape.computeDistanceProxy
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
Returns the mass data for this shape.
density
number
The density in kilograms per meter squared.
Returns
void
Inherited from
getChildCount()
getChildCount():
1
Get the number of child primitives.
Returns
1
Inherited from
getRadius()
getRadius():
number
Returns
number
Inherited from
getType()
getType():
"polygon"
Get the type of this shape. You can use this to down cast to the concrete shape.
Returns
"polygon"
the shape type.
Inherited from
rayCast()
rayCast(
output,input,xf,childIndex):boolean
Cast a ray against a child shape.
Parameters
output
The ray-cast results.
input
The ray-cast input parameters.
xf
The transform to be applied to the shape.
childIndex
number
The child shape index
Returns
boolean
Inherited from
testPoint()
testPoint(
xf,p):boolean
Test a point for containment in this shape. This only works for convex shapes.
Parameters
xf
The shape world transform.
p
A point in world coordinates.
Returns
boolean
Inherited from
validate()
validate():
boolean
Validate convexity. This is a very time consuming operation.
Returns
boolean
true if valid
Inherited from
isValid()
staticisValid(obj):boolean
Parameters
obj
any
Returns
boolean