mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Fix body leaving area gravity influence
This commit is contained in:
parent
9d1cbab1c4
commit
492f1c2406
@ -66,6 +66,7 @@ bool GodotAreaPair2D::pre_solve(real_t p_step) {
|
||||
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = true;
|
||||
body->add_area(area);
|
||||
}
|
||||
|
||||
@ -74,6 +75,7 @@ bool GodotAreaPair2D::pre_solve(real_t p_step) {
|
||||
}
|
||||
} else {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = false;
|
||||
body->remove_area(area);
|
||||
}
|
||||
|
||||
@ -103,7 +105,8 @@ GodotAreaPair2D::GodotAreaPair2D(GodotBody2D *p_body, int p_body_shape, GodotAre
|
||||
|
||||
GodotAreaPair2D::~GodotAreaPair2D() {
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
if (body_has_attached_area) {
|
||||
body_has_attached_area = false;
|
||||
body->remove_area(area);
|
||||
}
|
||||
if (area->has_monitor_callback()) {
|
||||
|
@ -43,6 +43,7 @@ class GodotAreaPair2D : public GodotConstraint2D {
|
||||
bool colliding = false;
|
||||
bool has_space_override = false;
|
||||
bool process_collision = false;
|
||||
bool body_has_attached_area = false;
|
||||
|
||||
public:
|
||||
virtual bool setup(real_t p_step) override;
|
||||
|
@ -67,6 +67,7 @@ bool GodotAreaPair3D::pre_solve(real_t p_step) {
|
||||
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = true;
|
||||
body->add_area(area);
|
||||
}
|
||||
|
||||
@ -75,6 +76,7 @@ bool GodotAreaPair3D::pre_solve(real_t p_step) {
|
||||
}
|
||||
} else {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = false;
|
||||
body->remove_area(area);
|
||||
}
|
||||
|
||||
@ -104,7 +106,8 @@ GodotAreaPair3D::GodotAreaPair3D(GodotBody3D *p_body, int p_body_shape, GodotAre
|
||||
|
||||
GodotAreaPair3D::~GodotAreaPair3D() {
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
if (body_has_attached_area) {
|
||||
body_has_attached_area = false;
|
||||
body->remove_area(area);
|
||||
}
|
||||
if (area->has_monitor_callback()) {
|
||||
@ -242,6 +245,7 @@ bool GodotAreaSoftBodyPair3D::pre_solve(real_t p_step) {
|
||||
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = true;
|
||||
soft_body->add_area(area);
|
||||
}
|
||||
|
||||
@ -250,6 +254,7 @@ bool GodotAreaSoftBodyPair3D::pre_solve(real_t p_step) {
|
||||
}
|
||||
} else {
|
||||
if (has_space_override) {
|
||||
body_has_attached_area = false;
|
||||
soft_body->remove_area(area);
|
||||
}
|
||||
|
||||
@ -276,7 +281,8 @@ GodotAreaSoftBodyPair3D::GodotAreaSoftBodyPair3D(GodotSoftBody3D *p_soft_body, i
|
||||
|
||||
GodotAreaSoftBodyPair3D::~GodotAreaSoftBodyPair3D() {
|
||||
if (colliding) {
|
||||
if (has_space_override) {
|
||||
if (body_has_attached_area) {
|
||||
body_has_attached_area = false;
|
||||
soft_body->remove_area(area);
|
||||
}
|
||||
if (area->has_monitor_callback()) {
|
||||
|
@ -44,6 +44,7 @@ class GodotAreaPair3D : public GodotConstraint3D {
|
||||
bool colliding = false;
|
||||
bool process_collision = false;
|
||||
bool has_space_override = false;
|
||||
bool body_has_attached_area = false;
|
||||
|
||||
public:
|
||||
virtual bool setup(real_t p_step) override;
|
||||
@ -83,6 +84,7 @@ class GodotAreaSoftBodyPair3D : public GodotConstraint3D {
|
||||
bool colliding = false;
|
||||
bool process_collision = false;
|
||||
bool has_space_override = false;
|
||||
bool body_has_attached_area = false;
|
||||
|
||||
public:
|
||||
virtual bool setup(real_t p_step) override;
|
||||
|
Loading…
Reference in New Issue
Block a user