I've gotten capsule shapes to work with the new code. This time the capsules collide appropriately.
I didn't modify the project file because my VC++ sent it through the conversion wizard. I added the following files:
Collision/Shapes/b2CapsuleShape.h
Collision/Shapes/b2CapsuleShape.cpp
Dynamics/Contacts/b2CapsuleAndCircleContact.h
Dynamics/Contacts/b2CapsuleAndCircleContact.cpp
Dynamics/Contacts/b2CapsuleContact.h
Dynamics/Contacts/b2CapsuleContact.cpp
Dynamics/Contacts/b2PolygonAndCapsuleContact.h
Dynamics/Contacts/b2PolygonAndCapsuleContact.cpp
I modified the Raycast and PolyShapes tests to produce capsules for the '6' and '7' keys.
Hacks I used:
reintepret_cast to convert from a b2Segment* to b2Vec2* for the b2Distance support proxy.
It's actually a valid cast, assuming the structure doesn't change. I didn't want to allocate memory for the two points, and I have them stored as a b2Segment.
Conversion of b2CapsuleShape to b2PolygonShape for collisions, with modified radius.
The new edge polygons already do capsule collision, so I just used the polygon collision functions rather than writing my own. I chose to convert to polygon on each collision rather than precalculating the polygon because it was easiest and space efficient.
See updated patch further down thread.
I didn't modify the project file because my VC++ sent it through the conversion wizard. I added the following files:
Collision/Shapes/b2CapsuleShape.h
Collision/Shapes/b2CapsuleShape.cpp
Dynamics/Contacts/b2CapsuleAndCircleContact.h
Dynamics/Contacts/b2CapsuleAndCircleContact.cpp
Dynamics/Contacts/b2CapsuleContact.h
Dynamics/Contacts/b2CapsuleContact.cpp
Dynamics/Contacts/b2PolygonAndCapsuleContact.h
Dynamics/Contacts/b2PolygonAndCapsuleContact.cpp
I modified the Raycast and PolyShapes tests to produce capsules for the '6' and '7' keys.
Hacks I used:
reintepret_cast to convert from a b2Segment* to b2Vec2* for the b2Distance support proxy.
It's actually a valid cast, assuming the structure doesn't change. I didn't want to allocate memory for the two points, and I have them stored as a b2Segment.
Conversion of b2CapsuleShape to b2PolygonShape for collisions, with modified radius.
The new edge polygons already do capsule collision, so I just used the polygon collision functions rather than writing my own. I chose to convert to polygon on each collision rather than precalculating the polygon because it was easiest and space efficient.
See updated patch further down thread.