#include <b2_chain_shape.h>
Public Member Functions | |
b2ChainShape () | |
void | Clear () |
Clear all data. More... | |
b2Shape * | Clone (b2BlockAllocator *allocator) const override |
Implement b2Shape. Vertices are cloned using b2Alloc. More... | |
void | ComputeAABB (b2AABB *aabb, const b2Transform &transform, int32 childIndex) const override |
void | ComputeMass (b2MassData *massData, float density) const override |
void | CreateChain (const b2Vec2 *vertices, int32 count, const b2Vec2 &prevVertex, const b2Vec2 &nextVertex) |
void | CreateLoop (const b2Vec2 *vertices, int32 count) |
int32 | GetChildCount () const override |
void | GetChildEdge (b2EdgeShape *edge, int32 index) const |
Get a child edge. More... | |
bool | RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const override |
Implement b2Shape. More... | |
bool | TestPoint (const b2Transform &transform, const b2Vec2 &p) const override |
~b2ChainShape () | |
The destructor frees the vertices using b2Free. More... | |
![]() | |
Type | GetType () const |
virtual | ~b2Shape () |
Public Attributes | |
int32 | m_count |
The vertex count. More... | |
b2Vec2 | m_nextVertex |
b2Vec2 | m_prevVertex |
b2Vec2 * | m_vertices |
The vertices. Owned by this class. More... | |
![]() | |
float | m_radius |
Type | m_type |
Additional Inherited Members | |
![]() | |
enum | Type { e_circle = 0, e_edge = 1, e_polygon = 2, e_chain = 3, e_typeCount = 4 } |
A chain shape is a free form sequence of line segments. The chain has one-sided collision, with the surface normal pointing to the right of the edge. This provides a counter-clockwise winding like the polygon shape. Connectivity information is used to create smooth collisions.
Definition at line 36 of file b2_chain_shape.h.
|
inline |
Definition at line 93 of file b2_chain_shape.h.
b2ChainShape::~b2ChainShape | ( | ) |
The destructor frees the vertices using b2Free.
Definition at line 31 of file b2_chain_shape.cpp.
void b2ChainShape::Clear | ( | ) |
Clear all data.
Definition at line 36 of file b2_chain_shape.cpp.
|
overridevirtual |
Implement b2Shape. Vertices are cloned using b2Alloc.
Implements b2Shape.
Definition at line 86 of file b2_chain_shape.cpp.
|
overridevirtual |
|
overridevirtual |
Chains have zero mass.
Implements b2Shape.
Definition at line 178 of file b2_chain_shape.cpp.
void b2ChainShape::CreateChain | ( | const b2Vec2 * | vertices, |
int32 | count, | ||
const b2Vec2 & | prevVertex, | ||
const b2Vec2 & | nextVertex | ||
) |
Create a chain with ghost vertices to connect multiple chains together.
vertices | an array of vertices, these are copied |
count | the vertex count |
prevVertex | previous vertex from chain that connects to the start |
nextVertex | next vertex from chain that connects to the end |
Definition at line 68 of file b2_chain_shape.cpp.
Create a loop. This automatically adjusts connectivity.
vertices | an array of vertices, these are copied |
count | the vertex count |
Definition at line 43 of file b2_chain_shape.cpp.
|
overridevirtual |
Implements b2Shape.
Definition at line 94 of file b2_chain_shape.cpp.
void b2ChainShape::GetChildEdge | ( | b2EdgeShape * | edge, |
int32 | index | ||
) | const |
Get a child edge.
Definition at line 100 of file b2_chain_shape.cpp.
|
overridevirtual |
|
overridevirtual |
This always return false.
Implements b2Shape.
Definition at line 129 of file b2_chain_shape.cpp.
int32 b2ChainShape::m_count |
The vertex count.
Definition at line 88 of file b2_chain_shape.h.
b2Vec2 b2ChainShape::m_nextVertex |
Definition at line 90 of file b2_chain_shape.h.
b2Vec2 b2ChainShape::m_prevVertex |
Definition at line 90 of file b2_chain_shape.h.
b2Vec2* b2ChainShape::m_vertices |
The vertices. Owned by this class.
Definition at line 85 of file b2_chain_shape.h.