Remove bodies pointer from ContactPoint
This commit is contained in:
parent
05f665040f
commit
16d27f40b9
|
@ -433,6 +433,8 @@ void CollisionDetection::notifyContact(OverlappingPair* overlappingPair, const C
|
||||||
void CollisionDetection::createContact(OverlappingPair* overlappingPair,
|
void CollisionDetection::createContact(OverlappingPair* overlappingPair,
|
||||||
const ContactPointInfo& contactInfo) {
|
const ContactPointInfo& contactInfo) {
|
||||||
|
|
||||||
|
PROFILE("CollisionDetection::createContact()");
|
||||||
|
|
||||||
// Create a new contact
|
// Create a new contact
|
||||||
ContactPoint* contact = new (mWorld->mPoolAllocator.allocate(sizeof(ContactPoint)))
|
ContactPoint* contact = new (mWorld->mPoolAllocator.allocate(sizeof(ContactPoint)))
|
||||||
ContactPoint(contactInfo);
|
ContactPoint(contactInfo);
|
||||||
|
|
|
@ -32,8 +32,7 @@ using namespace std;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
ContactPoint::ContactPoint(const ContactPointInfo& contactInfo)
|
ContactPoint::ContactPoint(const ContactPointInfo& contactInfo)
|
||||||
: mBody1(contactInfo.shape1->getBody()), mBody2(contactInfo.shape2->getBody()),
|
: mNormal(contactInfo.normal),
|
||||||
mNormal(contactInfo.normal),
|
|
||||||
mPenetrationDepth(contactInfo.penetrationDepth),
|
mPenetrationDepth(contactInfo.penetrationDepth),
|
||||||
mLocalPointOnBody1(contactInfo.localPoint1),
|
mLocalPointOnBody1(contactInfo.localPoint1),
|
||||||
mLocalPointOnBody2(contactInfo.localPoint2),
|
mLocalPointOnBody2(contactInfo.localPoint2),
|
||||||
|
|
|
@ -101,12 +101,6 @@ class ContactPoint {
|
||||||
|
|
||||||
// -------------------- Attributes -------------------- //
|
// -------------------- Attributes -------------------- //
|
||||||
|
|
||||||
/// First rigid body of the contact
|
|
||||||
CollisionBody* mBody1;
|
|
||||||
|
|
||||||
/// Second rigid body of the contact
|
|
||||||
CollisionBody* mBody2;
|
|
||||||
|
|
||||||
/// Normalized normal vector of the contact (from body1 toward body2) in world space
|
/// Normalized normal vector of the contact (from body1 toward body2) in world space
|
||||||
const Vector3 mNormal;
|
const Vector3 mNormal;
|
||||||
|
|
||||||
|
@ -147,12 +141,6 @@ class ContactPoint {
|
||||||
/// Deleted assignment operator
|
/// Deleted assignment operator
|
||||||
ContactPoint& operator=(const ContactPoint& contact) = delete;
|
ContactPoint& operator=(const ContactPoint& contact) = delete;
|
||||||
|
|
||||||
/// Return the reference to the body 1
|
|
||||||
CollisionBody* getBody1() const;
|
|
||||||
|
|
||||||
/// Return the reference to the body 2
|
|
||||||
CollisionBody* getBody2() const;
|
|
||||||
|
|
||||||
/// Return the normal vector of the contact
|
/// Return the normal vector of the contact
|
||||||
Vector3 getNormal() const;
|
Vector3 getNormal() const;
|
||||||
|
|
||||||
|
@ -196,16 +184,6 @@ class ContactPoint {
|
||||||
size_t getSizeInBytes() const;
|
size_t getSizeInBytes() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the reference to the body 1
|
|
||||||
inline CollisionBody* ContactPoint::getBody1() const {
|
|
||||||
return mBody1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the reference to the body 2
|
|
||||||
inline CollisionBody* ContactPoint::getBody2() const {
|
|
||||||
return mBody2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the normal vector of the contact
|
// Return the normal vector of the contact
|
||||||
inline Vector3 ContactPoint::getNormal() const {
|
inline Vector3 ContactPoint::getNormal() const {
|
||||||
return mNormal;
|
return mNormal;
|
||||||
|
|
|
@ -115,8 +115,8 @@ void ContactSolver::initializeForIsland(Island* island) {
|
||||||
assert(externalManifold->getNbContactPoints() > 0);
|
assert(externalManifold->getNbContactPoints() > 0);
|
||||||
|
|
||||||
// Get the two bodies of the contact
|
// Get the two bodies of the contact
|
||||||
RigidBody* body1 = static_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody1());
|
RigidBody* body1 = static_cast<RigidBody*>(externalManifold->getBody1());
|
||||||
RigidBody* body2 = static_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody2());
|
RigidBody* body2 = static_cast<RigidBody*>(externalManifold->getBody2());
|
||||||
assert(body1 != nullptr);
|
assert(body1 != nullptr);
|
||||||
assert(body2 != nullptr);
|
assert(body2 != nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user