You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Merge pull request #27371 from ShyRed/fixdisabled2dcollisions
Allow adding disabled shapes
This commit is contained in:
@@ -32,13 +32,14 @@
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
#include "space_sw.h"
|
||||
|
||||
void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform) {
|
||||
void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform, bool p_disabled) {
|
||||
|
||||
Shape s;
|
||||
s.shape = p_shape;
|
||||
s.xform = p_transform;
|
||||
s.xform_inv = s.xform.affine_inverse();
|
||||
s.bpid = 0; //needs update
|
||||
s.disabled = p_disabled;
|
||||
shapes.push_back(s);
|
||||
p_shape->add_owner(this);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
void _shape_changed();
|
||||
|
||||
_FORCE_INLINE_ Type get_type() const { return type; }
|
||||
void add_shape(ShapeSW *p_shape, const Transform &p_transform = Transform());
|
||||
void add_shape(ShapeSW *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
|
||||
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(); }
|
||||
|
||||
@@ -283,7 +283,7 @@ PhysicsServer::AreaSpaceOverrideMode PhysicsServerSW::area_get_space_override_mo
|
||||
return area->get_space_override_mode();
|
||||
}
|
||||
|
||||
void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform) {
|
||||
void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) {
|
||||
|
||||
AreaSW *area = area_owner.get(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
@@ -291,7 +291,7 @@ void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p
|
||||
ShapeSW *shape = shape_owner.get(p_shape);
|
||||
ERR_FAIL_COND(!shape);
|
||||
|
||||
area->add_shape(shape, p_transform);
|
||||
area->add_shape(shape, p_transform, p_disabled);
|
||||
}
|
||||
|
||||
void PhysicsServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
|
||||
@@ -540,7 +540,7 @@ PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const {
|
||||
return body->get_mode();
|
||||
};
|
||||
|
||||
void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform) {
|
||||
void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) {
|
||||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
@@ -548,7 +548,7 @@ void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p
|
||||
ShapeSW *shape = shape_owner.get(p_shape);
|
||||
ERR_FAIL_COND(!shape);
|
||||
|
||||
body->add_shape(shape, p_transform);
|
||||
body->add_shape(shape, p_transform, p_disabled);
|
||||
}
|
||||
|
||||
void PhysicsServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
virtual void area_set_space(RID p_area, RID p_space);
|
||||
virtual RID area_get_space(RID p_area) const;
|
||||
|
||||
virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform());
|
||||
virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
|
||||
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape);
|
||||
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform);
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
virtual void body_set_mode(RID p_body, BodyMode p_mode);
|
||||
virtual BodyMode body_get_mode(RID p_body) const;
|
||||
|
||||
virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform());
|
||||
virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
|
||||
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape);
|
||||
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user