diff options
author | Stanislav <stas.ponkrashov@gmail.com> | 2018-12-08 00:09:39 +0300 |
---|---|---|
committer | Stanislav <stas.ponkrashov@gmail.com> | 2018-12-12 17:48:35 +0300 |
commit | 9edf98e8419ce68085a308ba4ae65fe8bf8a9f17 (patch) | |
tree | 971ee602c52ac0935a2752bd8545c2fd6db69734 /servers/physics | |
parent | 0611b674c19f2eb9cc6baaee25cf7c8146c643fb (diff) |
Disabled CollisionShape and CollisionShape2D are not processed now
Fixes #24183
Diffstat (limited to 'servers/physics')
-rw-r--r-- | servers/physics/body_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics/collision_object_sw.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index 36511f78ce..74cb724bb3 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -87,6 +87,10 @@ void BodySW::update_inertias() { for (int i = 0; i < get_shape_count(); i++) { + if (is_shape_disabled(i)) { + continue; + } + const ShapeSW *shape = get_shape(i); real_t area = get_shape_area(i); diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h index 993799ee10..dc482baccb 100644 --- a/servers/physics/collision_object_sw.h +++ b/servers/physics/collision_object_sw.h @@ -122,6 +122,10 @@ public: void set_shape(int p_index, ShapeSW *p_shape); void set_shape_transform(int p_index, const Transform &p_transform); _FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } + _FORCE_INLINE_ bool is_shape_disabled(int p_index) const { + CRASH_BAD_INDEX(p_index, shapes.size()); + return shapes[p_index].disabled; + } _FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; } _FORCE_INLINE_ const Transform &get_shape_transform(int p_index) const { return shapes[p_index].xform; } _FORCE_INLINE_ const Transform &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } |