summaryrefslogtreecommitdiff
path: root/modules/bullet/godot_result_callbacks.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/godot_result_callbacks.h')
-rw-r--r--modules/bullet/godot_result_callbacks.h28
1 files changed, 9 insertions, 19 deletions
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index d505bd0de1..ba5142676b 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -36,8 +36,6 @@
#include "btBulletDynamicsCommon.h"
#include "servers/physics_server.h"
-#define MAX_PENETRATION_DEPTH 0.005
-
class RigidBodyBullet;
/// This class is required to implement custom collision behaviour in the broadphase
@@ -90,7 +88,7 @@ public:
struct GodotClosestConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback {
public:
const Set<RID> *m_exclude;
- int m_shapePart;
+ int m_shapeId;
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude)
: btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {}
@@ -151,39 +149,31 @@ public:
virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1);
};
-struct GodotRecoverAndClosestContactResultCallback : public btCollisionWorld::ContactResultCallback {
-public:
+struct GodotDeepPenetrationContactResultCallback : public btManifoldResult {
btVector3 m_pointNormalWorld;
btVector3 m_pointWorld;
btScalar m_penetration_distance;
int m_other_compound_shape_index;
const btCollisionObject *m_pointCollisionObject;
- const RigidBodyBullet *m_self_object;
- bool m_ignore_areas;
-
btScalar m_most_penetrated_distance;
- btVector3 m_recover_penetration;
-
- GodotRecoverAndClosestContactResultCallback()
- : m_pointCollisionObject(NULL), m_penetration_distance(0), m_other_compound_shape_index(0), m_self_object(NULL), m_ignore_areas(true), m_most_penetrated_distance(1e20), m_recover_penetration(0, 0, 0) {}
- GodotRecoverAndClosestContactResultCallback(const RigidBodyBullet *p_self_object, bool p_ignore_areas)
- : m_pointCollisionObject(NULL), m_penetration_distance(0), m_other_compound_shape_index(0), m_self_object(p_self_object), m_ignore_areas(p_ignore_areas), m_most_penetrated_distance(9999999999), m_recover_penetration(0, 0, 0) {}
+ GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
+ : btManifoldResult(body0Wrap, body1Wrap),
+ m_pointCollisionObject(NULL),
+ m_penetration_distance(0),
+ m_other_compound_shape_index(0),
+ m_most_penetrated_distance(1e20) {}
void reset() {
m_pointCollisionObject = NULL;
m_most_penetrated_distance = 1e20;
- m_recover_penetration.setZero();
}
bool hasHit() {
return m_pointCollisionObject;
}
- virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
-
- virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1);
+ virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth);
};
-
#endif // GODOT_RESULT_CALLBACKS_H