summaryrefslogtreecommitdiffstats
path: root/modules/bullet/collision_object_bullet.h
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-08 11:35:35 +0200
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-08 14:40:24 +0200
commit655694b394bb27c031ab5e3b609010b45b80d69e (patch)
treec8708bb691222a6250ff2ae844b28fa9bc71739c /modules/bullet/collision_object_bullet.h
parent234289de2b10b76d368650a144a35c040a196ee0 (diff)
downloadredot-engine-655694b394bb27c031ab5e3b609010b45b80d69e.tar.gz
Fixed RigidBody stuttering when changing collision layer/mask
- Changing collision layer/mask now only updates the broadphase proxy to avoid the velocity to be reset each time (also avoids unnecessary computations) - No rigid body update at all when the collision layer/mask stays the same - Same changes for Area for optimization purpose Fixes #32577
Diffstat (limited to 'modules/bullet/collision_object_bullet.h')
-rw-r--r--modules/bullet/collision_object_bullet.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index c9430bec18..04231b0814 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -167,14 +167,18 @@ public:
_FORCE_INLINE_ const VSet<RID> &get_exceptions() const { return exceptions; }
_FORCE_INLINE_ void set_collision_layer(uint32_t p_layer) {
- collisionLayer = p_layer;
- on_collision_filters_change();
+ if (collisionLayer != p_layer) {
+ collisionLayer = p_layer;
+ on_collision_filters_change();
+ }
}
_FORCE_INLINE_ uint32_t get_collision_layer() const { return collisionLayer; }
_FORCE_INLINE_ void set_collision_mask(uint32_t p_mask) {
- collisionMask = p_mask;
- on_collision_filters_change();
+ if (collisionMask != p_mask) {
+ collisionMask = p_mask;
+ on_collision_filters_change();
+ }
}
_FORCE_INLINE_ uint32_t get_collision_mask() const { return collisionMask; }