summaryrefslogtreecommitdiff
path: root/servers/physics_2d/body_2d_sw.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics_2d/body_2d_sw.h')
-rw-r--r--servers/physics_2d/body_2d_sw.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index ca4d80a15b..e34686f3ac 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -81,6 +81,7 @@ class Body2DSW : public CollisionObject2DSW {
bool active;
bool can_sleep;
bool first_time_kinematic;
+ bool using_one_way_cache;
void _update_inertia();
virtual void _shapes_changed();
Matrix32 new_transform;
@@ -229,12 +230,17 @@ public:
_FORCE_INLINE_ void set_continuous_collision_detection_mode(Physics2DServer::CCDMode p_mode) { continuous_cd_mode=p_mode; }
_FORCE_INLINE_ Physics2DServer::CCDMode get_continuous_collision_detection_mode() const { return continuous_cd_mode; }
- void set_one_way_collision_direction(const Vector2& p_dir) { one_way_collision_direction=p_dir; }
+ void set_one_way_collision_direction(const Vector2& p_dir) {
+ one_way_collision_direction=p_dir;
+ using_one_way_cache=one_way_collision_direction!=Vector2();
+ }
Vector2 get_one_way_collision_direction() const { return one_way_collision_direction; }
void set_one_way_collision_max_depth(float p_depth) { one_way_collision_max_depth=p_depth; }
float get_one_way_collision_max_depth() const { return one_way_collision_max_depth; }
+ _FORCE_INLINE_ bool is_using_one_way_collision() const { return using_one_way_cache; }
+
void set_space(Space2DSW *p_space);
void update_inertias();