Activate Body(2D)SW when switching to rigid or character mode.
This commit is contained in:
parent
1fed266bf5
commit
13798746e7
@ -260,12 +260,14 @@ void BodySW::set_mode(PhysicsServer::BodyMode p_mode) {
|
|||||||
|
|
||||||
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
||||||
_set_static(false);
|
_set_static(false);
|
||||||
|
set_active(true);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case PhysicsServer::BODY_MODE_CHARACTER: {
|
case PhysicsServer::BODY_MODE_CHARACTER: {
|
||||||
|
|
||||||
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
||||||
_set_static(false);
|
_set_static(false);
|
||||||
|
set_active(true);
|
||||||
angular_velocity = Vector3();
|
angular_velocity = Vector3();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
|
|||||||
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
||||||
_inv_inertia = inertia > 0 ? (1.0 / inertia) : 0;
|
_inv_inertia = inertia > 0 ? (1.0 / inertia) : 0;
|
||||||
_set_static(false);
|
_set_static(false);
|
||||||
|
set_active(true);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Physics2DServer::BODY_MODE_CHARACTER: {
|
case Physics2DServer::BODY_MODE_CHARACTER: {
|
||||||
@ -245,6 +246,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
|
|||||||
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
|
||||||
_inv_inertia = 0;
|
_inv_inertia = 0;
|
||||||
_set_static(false);
|
_set_static(false);
|
||||||
|
set_active(true);
|
||||||
angular_velocity = 0;
|
angular_velocity = 0;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user