public 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.
Fields
public final Vec2 m_vertex1 | edge vertex 1 |
public final Vec2 m_vertex2 | edge vertex 2 |
public final Vec2 m_vertex0 | optional adjacent vertex 1. Used for smooth collision |
public final Vec2 m_vertex3 | optional adjacent vertex 2. Used for smooth collision |
public boolean m_hasVertex0 | |
public boolean m_hasVertex3 |
Constructors
public EdgeShape() |
Methods
public int getChildCount() | Get the number of child primitives |
public void set(Vec2 v1, Vec2 v2) | |
public boolean testPoint(Transform xf, Vec2 p) | Test a point for containment in this shape. |
public boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex) | Cast a ray against a child shape. |
public void computeAABB(AABB aabb, Transform xf, int childIndex) | Given a transform, compute the associated axis aligned bounding box for a child shape. |
public void computeMass(MassData massData, float density) | Compute the mass properties of this shape using its dimensions and density. |
public Shape clone() |
Inherited fields
Inherited methods
Field details
m_vertex1
public final Vec2 m_vertex1edge vertex 1
m_vertex2
public final Vec2 m_vertex2edge vertex 2
m_vertex0
public final Vec2 m_vertex0optional adjacent vertex 1. Used for smooth collision
m_vertex3
public final Vec2 m_vertex3optional adjacent vertex 2. Used for smooth collision
m_hasVertex0
public boolean m_hasVertex0m_hasVertex3
public boolean m_hasVertex3Constructor details
EdgeShape
public EdgeShape()Method details
getChildCount
public int getChildCount()Get the number of child primitives
set
public void set(Vec2 v1, Vec2 v2)testPoint
public boolean testPoint(Transform xf, Vec2 p)Test a point for containment in this shape. This only works for convex shapes.
Parameters
xfTransform- the shape world transform.
pVec2- a point in world coordinates.
raycast
public boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex)Cast a ray against a child shape.
Returns
if hit
computeAABB
public void computeAABB(AABB aabb, Transform xf, int childIndex)Given a transform, compute the associated axis aligned bounding box for a child shape.
computeMass
public void computeMass(MassData massData, float density)Compute the mass properties of this shape using its dimensions and density. The inertia tensor
is computed about the local origin.
Parameters
massDataMassData- returns the mass data for this shape.
densityfloat- the density in kilograms per meter squared.
clone
public Shape clone()