Class ChainShape
java.lang.Object
org.jbox2d.collision.shapes.Shape
org.jbox2d.collision.shapes.ChainShape
A chain shape is a free form sequence of line segments. The chain has two-sided collision, so you
can use inside and outside collision. Therefore, you may use any winding order. Since there may
be many vertices, they are allocated using Alloc. Connectivity information is used to create
smooth collisions. WARNING The chain will not collide properly if there are self-intersections.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()voidcomputeAABB(AABB aabb, Transform xf, int childIndex) Given a transform, compute the associated axis aligned bounding box for a child shape.voidcomputeMass(MassData massData, float density) Compute the mass properties of this shape using its dimensions and density.voidcreateChain(Vec2[] vertices, int count) Create a chain with isolated end vertices.voidcreateLoop(Vec2[] vertices, int count) Create a loop.intGet the number of child primitivesvoidgetChildEdge(EdgeShape edge, int index) Get a child edge.booleanraycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex) Cast a ray against a child shape.voidsetNextVertex(Vec2 nextVertex) Establish connectivity to a vertex that follows the last vertex.voidsetPrevVertex(Vec2 prevVertex) Establish connectivity to a vertex that precedes the first vertex.booleanTest a point for containment in this shape.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
m_vertices
-
m_count
public int m_count -
m_prevVertex
-
m_nextVertex
-
m_hasPrevVertex
public boolean m_hasPrevVertex -
m_hasNextVertex
public boolean m_hasNextVertex -
pool0
-
-
Constructor Details
-
ChainShape
public ChainShape()
-
-
Method Details
-
getChildCount
public int getChildCount()Description copied from class:ShapeGet the number of child primitives- Specified by:
getChildCountin classShape- Returns:
-
getChildEdge
Get a child edge. -
testPoint
-
raycast
Description copied from class:ShapeCast a ray against a child shape. -
computeAABB
Description copied from class:ShapeGiven a transform, compute the associated axis aligned bounding box for a child shape.- Specified by:
computeAABBin classShape
-
computeMass
Description copied from class:ShapeCompute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.- Specified by:
computeMassin classShape- Parameters:
massData- returns the mass data for this shape.density- the density in kilograms per meter squared.
-
clone
-
createLoop
Create a loop. This automatically adjusts connectivity.- Parameters:
vertices- an array of vertices, these are copiedcount- the vertex count
-
createChain
Create a chain with isolated end vertices.- Parameters:
vertices- an array of vertices, these are copiedcount- the vertex count
-
setPrevVertex
Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.- Parameters:
prevVertex-
-
setNextVertex
Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.- Parameters:
nextVertex-
-