Disabled CollisionShape and CollisionShape2D are not processed now

Fixes #24183
This commit is contained in:
Stanislav 2018-12-08 00:09:39 +03:00
parent 0611b674c1
commit 9edf98e841
4 changed files with 16 additions and 0 deletions

View File

@ -87,6 +87,10 @@ void BodySW::update_inertias() {
for (int i = 0; i < get_shape_count(); i++) { for (int i = 0; i < get_shape_count(); i++) {
if (is_shape_disabled(i)) {
continue;
}
const ShapeSW *shape = get_shape(i); const ShapeSW *shape = get_shape(i);
real_t area = get_shape_area(i); real_t area = get_shape_area(i);

View File

@ -122,6 +122,10 @@ public:
void set_shape(int p_index, ShapeSW *p_shape); void set_shape(int p_index, ShapeSW *p_shape);
void set_shape_transform(int p_index, const Transform &p_transform); void set_shape_transform(int p_index, const Transform &p_transform);
_FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } _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_ 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_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; } _FORCE_INLINE_ const Transform &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; }

View File

@ -61,6 +61,10 @@ void Body2DSW::update_inertias() {
for (int i = 0; i < get_shape_count(); i++) { for (int i = 0; i < get_shape_count(); i++) {
if (is_shape_disabled(i)) {
continue;
}
const Shape2DSW *shape = get_shape(i); const Shape2DSW *shape = get_shape(i);
real_t area = get_shape_aabb(i).get_area(); real_t area = get_shape_aabb(i).get_area();

View File

@ -115,6 +115,10 @@ public:
void set_shape_metadata(int p_index, const Variant &p_metadata); void set_shape_metadata(int p_index, const Variant &p_metadata);
_FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } _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_ Shape2DSW *get_shape(int p_index) const { _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const {
CRASH_BAD_INDEX(p_index, shapes.size()); CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].shape; return shapes[p_index].shape;