Merge pull request #106346 from mihe/jolt/scu-support
Fix SCU build issues related to Jolt Physics
This commit is contained in:
@ -38,9 +38,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_BIAS = 0.3;
|
||||
constexpr double DEFAULT_SOFTNESS = 0.8;
|
||||
constexpr double DEFAULT_RELAXATION = 1.0;
|
||||
constexpr double CONE_TWIST_DEFAULT_BIAS = 0.3;
|
||||
constexpr double CONE_TWIST_DEFAULT_SOFTNESS = 0.8;
|
||||
constexpr double CONE_TWIST_DEFAULT_RELAXATION = 1.0;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -168,13 +168,13 @@ double JoltConeTwistJoint3D::get_param(PhysicsServer3D::ConeTwistJointParam p_pa
|
||||
return twist_limit_span;
|
||||
}
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: {
|
||||
return DEFAULT_BIAS;
|
||||
return CONE_TWIST_DEFAULT_BIAS;
|
||||
}
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: {
|
||||
return DEFAULT_SOFTNESS;
|
||||
return CONE_TWIST_DEFAULT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: {
|
||||
return DEFAULT_RELAXATION;
|
||||
return CONE_TWIST_DEFAULT_RELAXATION;
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(0.0, vformat("Unhandled cone twist joint parameter: '%d'. This should not happen. Please report this.", p_param));
|
||||
@ -193,17 +193,17 @@ void JoltConeTwistJoint3D::set_param(PhysicsServer3D::ConeTwistJointParam p_para
|
||||
_limits_changed();
|
||||
} break;
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_BIAS)) {
|
||||
if (!Math::is_equal_approx(p_value, CONE_TWIST_DEFAULT_BIAS)) {
|
||||
WARN_PRINT(vformat("Cone twist joint bias is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, CONE_TWIST_DEFAULT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Cone twist joint softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_RELAXATION)) {
|
||||
if (!Math::is_equal_approx(p_value, CONE_TWIST_DEFAULT_RELAXATION)) {
|
||||
WARN_PRINT(vformat("Cone twist joint relaxation is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -38,15 +38,15 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_LINEAR_LIMIT_SOFTNESS = 0.7;
|
||||
constexpr double DEFAULT_LINEAR_RESTITUTION = 0.5;
|
||||
constexpr double DEFAULT_LINEAR_DAMPING = 1.0;
|
||||
constexpr double G6DOF_DEFAULT_LINEAR_LIMIT_SOFTNESS = 0.7;
|
||||
constexpr double G6DOF_DEFAULT_LINEAR_RESTITUTION = 0.5;
|
||||
constexpr double G6DOF_DEFAULT_LINEAR_DAMPING = 1.0;
|
||||
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_SOFTNESS = 0.5;
|
||||
constexpr double DEFAULT_ANGULAR_DAMPING = 1.0;
|
||||
constexpr double DEFAULT_ANGULAR_RESTITUTION = 0.0;
|
||||
constexpr double DEFAULT_ANGULAR_FORCE_LIMIT = 0.0;
|
||||
constexpr double DEFAULT_ANGULAR_ERP = 0.5;
|
||||
constexpr double G6DOF_DEFAULT_ANGULAR_LIMIT_SOFTNESS = 0.5;
|
||||
constexpr double G6DOF_DEFAULT_ANGULAR_DAMPING = 1.0;
|
||||
constexpr double G6DOF_DEFAULT_ANGULAR_RESTITUTION = 0.0;
|
||||
constexpr double G6DOF_DEFAULT_ANGULAR_FORCE_LIMIT = 0.0;
|
||||
constexpr double G6DOF_DEFAULT_ANGULAR_ERP = 0.5;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -271,13 +271,13 @@ double JoltGeneric6DOFJoint3D::get_param(Axis p_axis, Param p_param) const {
|
||||
return limit_upper[axis_lin];
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
|
||||
return DEFAULT_LINEAR_LIMIT_SOFTNESS;
|
||||
return G6DOF_DEFAULT_LINEAR_LIMIT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION: {
|
||||
return DEFAULT_LINEAR_RESTITUTION;
|
||||
return G6DOF_DEFAULT_LINEAR_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING: {
|
||||
return DEFAULT_LINEAR_DAMPING;
|
||||
return G6DOF_DEFAULT_LINEAR_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: {
|
||||
return motor_speed[axis_lin];
|
||||
@ -301,19 +301,19 @@ double JoltGeneric6DOFJoint3D::get_param(Axis p_axis, Param p_param) const {
|
||||
return limit_upper[axis_ang];
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
|
||||
return DEFAULT_ANGULAR_LIMIT_SOFTNESS;
|
||||
return G6DOF_DEFAULT_ANGULAR_LIMIT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING: {
|
||||
return DEFAULT_ANGULAR_DAMPING;
|
||||
return G6DOF_DEFAULT_ANGULAR_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: {
|
||||
return DEFAULT_ANGULAR_RESTITUTION;
|
||||
return G6DOF_DEFAULT_ANGULAR_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
|
||||
return DEFAULT_ANGULAR_FORCE_LIMIT;
|
||||
return G6DOF_DEFAULT_ANGULAR_FORCE_LIMIT;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: {
|
||||
return DEFAULT_ANGULAR_ERP;
|
||||
return G6DOF_DEFAULT_ANGULAR_ERP;
|
||||
}
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: {
|
||||
return motor_speed[axis_ang];
|
||||
@ -350,17 +350,17 @@ void JoltGeneric6DOFJoint3D::set_param(Axis p_axis, Param p_param, double p_valu
|
||||
_limits_changed();
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_LIMIT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_LINEAR_LIMIT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("6DOF joint linear limit softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_LINEAR_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("6DOF joint linear restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_LINEAR_DAMPING)) {
|
||||
WARN_PRINT(vformat("6DOF joint linear damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
@ -393,27 +393,27 @@ void JoltGeneric6DOFJoint3D::set_param(Axis p_axis, Param p_param, double p_valu
|
||||
_limits_changed();
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_ANGULAR_LIMIT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("6DOF joint angular limit softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_ANGULAR_DAMPING)) {
|
||||
WARN_PRINT(vformat("6DOF joint angular damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_ANGULAR_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("6DOF joint angular restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_FORCE_LIMIT)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_ANGULAR_FORCE_LIMIT)) {
|
||||
WARN_PRINT(vformat("6DOF joint angular force limit is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_ERP)) {
|
||||
if (!Math::is_equal_approx(p_value, G6DOF_DEFAULT_ANGULAR_ERP)) {
|
||||
WARN_PRINT(vformat("6DOF joint angular ERP is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -41,10 +41,10 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_BIAS = 0.3;
|
||||
constexpr double DEFAULT_LIMIT_BIAS = 0.3;
|
||||
constexpr double DEFAULT_SOFTNESS = 0.9;
|
||||
constexpr double DEFAULT_RELAXATION = 1.0;
|
||||
constexpr double HINGE_DEFAULT_BIAS = 0.3;
|
||||
constexpr double HINGE_DEFAULT_LIMIT_BIAS = 0.3;
|
||||
constexpr double HINGE_DEFAULT_SOFTNESS = 0.9;
|
||||
constexpr double HINGE_DEFAULT_RELAXATION = 1.0;
|
||||
|
||||
double estimate_physics_step() {
|
||||
Engine *engine = Engine::get_singleton();
|
||||
@ -171,7 +171,7 @@ JoltHingeJoint3D::JoltHingeJoint3D(const JoltJoint3D &p_old_joint, JoltBody3D *p
|
||||
double JoltHingeJoint3D::get_param(Parameter p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer3D::HINGE_JOINT_BIAS: {
|
||||
return DEFAULT_BIAS;
|
||||
return HINGE_DEFAULT_BIAS;
|
||||
}
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: {
|
||||
return limit_upper;
|
||||
@ -180,13 +180,13 @@ double JoltHingeJoint3D::get_param(Parameter p_param) const {
|
||||
return limit_lower;
|
||||
}
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: {
|
||||
return DEFAULT_LIMIT_BIAS;
|
||||
return HINGE_DEFAULT_LIMIT_BIAS;
|
||||
}
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: {
|
||||
return DEFAULT_SOFTNESS;
|
||||
return HINGE_DEFAULT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: {
|
||||
return DEFAULT_RELAXATION;
|
||||
return HINGE_DEFAULT_RELAXATION;
|
||||
}
|
||||
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: {
|
||||
return motor_target_speed;
|
||||
@ -204,7 +204,7 @@ double JoltHingeJoint3D::get_param(Parameter p_param) const {
|
||||
void JoltHingeJoint3D::set_param(Parameter p_param, double p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer3D::HINGE_JOINT_BIAS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_BIAS)) {
|
||||
if (!Math::is_equal_approx(p_value, HINGE_DEFAULT_BIAS)) {
|
||||
WARN_PRINT(vformat("Hinge joint bias is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
@ -217,17 +217,17 @@ void JoltHingeJoint3D::set_param(Parameter p_param, double p_value) {
|
||||
_limits_changed();
|
||||
} break;
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LIMIT_BIAS)) {
|
||||
if (!Math::is_equal_approx(p_value, HINGE_DEFAULT_LIMIT_BIAS)) {
|
||||
WARN_PRINT(vformat("Hinge joint bias limit is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, HINGE_DEFAULT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Hinge joint softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_RELAXATION)) {
|
||||
if (!Math::is_equal_approx(p_value, HINGE_DEFAULT_RELAXATION)) {
|
||||
WARN_PRINT(vformat("Hinge joint relaxation is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int DEFAULT_SOLVER_PRIORITY = 1;
|
||||
constexpr int JOINT_DEFAULT_SOLVER_PRIORITY = 1;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -173,11 +173,11 @@ void JoltJoint3D::set_enabled(bool p_enabled) {
|
||||
}
|
||||
|
||||
int JoltJoint3D::get_solver_priority() const {
|
||||
return DEFAULT_SOLVER_PRIORITY;
|
||||
return JOINT_DEFAULT_SOLVER_PRIORITY;
|
||||
}
|
||||
|
||||
void JoltJoint3D::set_solver_priority(int p_priority) {
|
||||
if (p_priority != DEFAULT_SOLVER_PRIORITY) {
|
||||
if (p_priority != JOINT_DEFAULT_SOLVER_PRIORITY) {
|
||||
WARN_PRINT(vformat("Joint solver priority is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_BIAS = 0.3;
|
||||
constexpr double DEFAULT_DAMPING = 1.0;
|
||||
constexpr double DEFAULT_IMPULSE_CLAMP = 0.0;
|
||||
constexpr double PIN_DEFAULT_BIAS = 0.3;
|
||||
constexpr double PIN_DEFAULT_DAMPING = 1.0;
|
||||
constexpr double PIN_DEFAULT_IMPULSE_CLAMP = 0.0;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -82,13 +82,13 @@ void JoltPinJoint3D::set_local_b(const Vector3 &p_local_b) {
|
||||
double JoltPinJoint3D::get_param(PhysicsServer3D::PinJointParam p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer3D::PIN_JOINT_BIAS: {
|
||||
return DEFAULT_BIAS;
|
||||
return PIN_DEFAULT_BIAS;
|
||||
}
|
||||
case PhysicsServer3D::PIN_JOINT_DAMPING: {
|
||||
return DEFAULT_DAMPING;
|
||||
return PIN_DEFAULT_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: {
|
||||
return DEFAULT_IMPULSE_CLAMP;
|
||||
return PIN_DEFAULT_IMPULSE_CLAMP;
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(0.0, vformat("Unhandled pin joint parameter: '%d'. This should not happen. Please report this.", p_param));
|
||||
@ -99,17 +99,17 @@ double JoltPinJoint3D::get_param(PhysicsServer3D::PinJointParam p_param) const {
|
||||
void JoltPinJoint3D::set_param(PhysicsServer3D::PinJointParam p_param, double p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer3D::PIN_JOINT_BIAS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_BIAS)) {
|
||||
if (!Math::is_equal_approx(p_value, PIN_DEFAULT_BIAS)) {
|
||||
WARN_PRINT(vformat("Pin joint bias is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::PIN_JOINT_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, PIN_DEFAULT_DAMPING)) {
|
||||
WARN_PRINT(vformat("Pin joint damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_IMPULSE_CLAMP)) {
|
||||
if (!Math::is_equal_approx(p_value, PIN_DEFAULT_IMPULSE_CLAMP)) {
|
||||
WARN_PRINT(vformat("Pin joint impulse clamp is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -39,31 +39,31 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_LINEAR_LIMIT_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_LINEAR_LIMIT_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_LINEAR_LIMIT_DAMPING = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_LIMIT_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_LIMIT_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_LIMIT_DAMPING = 1.0;
|
||||
|
||||
constexpr double DEFAULT_LINEAR_MOTION_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_LINEAR_MOTION_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_LINEAR_MOTION_DAMPING = 0.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_MOTION_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_MOTION_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_MOTION_DAMPING = 0.0;
|
||||
|
||||
constexpr double DEFAULT_LINEAR_ORTHO_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_LINEAR_ORTHO_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_LINEAR_ORTHO_DAMPING = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_ORTHO_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_ORTHO_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_LINEAR_ORTHO_DAMPING = 1.0;
|
||||
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_UPPER = 0.0;
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_LOWER = 0.0;
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_ANGULAR_LIMIT_DAMPING = 0.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_LIMIT_UPPER = 0.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_LIMIT_LOWER = 0.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_LIMIT_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_LIMIT_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_LIMIT_DAMPING = 0.0;
|
||||
|
||||
constexpr double DEFAULT_ANGULAR_MOTION_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_ANGULAR_MOTION_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_ANGULAR_MOTION_DAMPING = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_MOTION_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_MOTION_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_MOTION_DAMPING = 1.0;
|
||||
|
||||
constexpr double DEFAULT_ANGULAR_ORTHO_SOFTNESS = 1.0;
|
||||
constexpr double DEFAULT_ANGULAR_ORTHO_RESTITUTION = 0.7;
|
||||
constexpr double DEFAULT_ANGULAR_ORTHO_DAMPING = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_ORTHO_SOFTNESS = 1.0;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_ORTHO_RESTITUTION = 0.7;
|
||||
constexpr double SLIDER_DEFAULT_ANGULAR_ORTHO_DAMPING = 1.0;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -187,64 +187,64 @@ double JoltSliderJoint3D::get_param(PhysicsServer3D::SliderJointParam p_param) c
|
||||
return limit_lower;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: {
|
||||
return DEFAULT_LINEAR_LIMIT_SOFTNESS;
|
||||
return SLIDER_DEFAULT_LINEAR_LIMIT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: {
|
||||
return DEFAULT_LINEAR_LIMIT_RESTITUTION;
|
||||
return SLIDER_DEFAULT_LINEAR_LIMIT_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: {
|
||||
return DEFAULT_LINEAR_LIMIT_DAMPING;
|
||||
return SLIDER_DEFAULT_LINEAR_LIMIT_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: {
|
||||
return DEFAULT_LINEAR_MOTION_SOFTNESS;
|
||||
return SLIDER_DEFAULT_LINEAR_MOTION_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: {
|
||||
return DEFAULT_LINEAR_MOTION_RESTITUTION;
|
||||
return SLIDER_DEFAULT_LINEAR_MOTION_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: {
|
||||
return DEFAULT_LINEAR_MOTION_DAMPING;
|
||||
return SLIDER_DEFAULT_LINEAR_MOTION_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: {
|
||||
return DEFAULT_LINEAR_ORTHO_SOFTNESS;
|
||||
return SLIDER_DEFAULT_LINEAR_ORTHO_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: {
|
||||
return DEFAULT_LINEAR_ORTHO_RESTITUTION;
|
||||
return SLIDER_DEFAULT_LINEAR_ORTHO_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: {
|
||||
return DEFAULT_LINEAR_ORTHO_DAMPING;
|
||||
return SLIDER_DEFAULT_LINEAR_ORTHO_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: {
|
||||
return DEFAULT_ANGULAR_LIMIT_UPPER;
|
||||
return SLIDER_DEFAULT_ANGULAR_LIMIT_UPPER;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: {
|
||||
return DEFAULT_ANGULAR_LIMIT_LOWER;
|
||||
return SLIDER_DEFAULT_ANGULAR_LIMIT_LOWER;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: {
|
||||
return DEFAULT_ANGULAR_LIMIT_SOFTNESS;
|
||||
return SLIDER_DEFAULT_ANGULAR_LIMIT_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: {
|
||||
return DEFAULT_ANGULAR_LIMIT_RESTITUTION;
|
||||
return SLIDER_DEFAULT_ANGULAR_LIMIT_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: {
|
||||
return DEFAULT_ANGULAR_LIMIT_DAMPING;
|
||||
return SLIDER_DEFAULT_ANGULAR_LIMIT_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: {
|
||||
return DEFAULT_ANGULAR_MOTION_SOFTNESS;
|
||||
return SLIDER_DEFAULT_ANGULAR_MOTION_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: {
|
||||
return DEFAULT_ANGULAR_MOTION_RESTITUTION;
|
||||
return SLIDER_DEFAULT_ANGULAR_MOTION_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: {
|
||||
return DEFAULT_ANGULAR_MOTION_DAMPING;
|
||||
return SLIDER_DEFAULT_ANGULAR_MOTION_DAMPING;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: {
|
||||
return DEFAULT_ANGULAR_ORTHO_SOFTNESS;
|
||||
return SLIDER_DEFAULT_ANGULAR_ORTHO_SOFTNESS;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: {
|
||||
return DEFAULT_ANGULAR_ORTHO_RESTITUTION;
|
||||
return SLIDER_DEFAULT_ANGULAR_ORTHO_RESTITUTION;
|
||||
}
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: {
|
||||
return DEFAULT_ANGULAR_ORTHO_DAMPING;
|
||||
return SLIDER_DEFAULT_ANGULAR_ORTHO_DAMPING;
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(0.0, vformat("Unhandled slider joint parameter: '%d'. This should not happen. Please report this.", p_param));
|
||||
@ -263,102 +263,102 @@ void JoltSliderJoint3D::set_param(PhysicsServer3D::SliderJointParam p_param, dou
|
||||
_limits_changed();
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_LIMIT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_LIMIT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint linear limit softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_LIMIT_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_LIMIT_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint linear limit restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_LIMIT_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_LIMIT_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint linear limit damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_MOTION_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_MOTION_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint linear motion softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_MOTION_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_MOTION_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint linear motion restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_MOTION_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_MOTION_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint linear motion damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_ORTHO_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_ORTHO_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint linear ortho softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_ORTHO_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_ORTHO_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint linear ortho restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_LINEAR_ORTHO_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_LINEAR_ORTHO_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint linear ortho damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_UPPER)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_LIMIT_UPPER)) {
|
||||
WARN_PRINT(vformat("Slider joint angular limits are not supported when using Jolt Physics. Any such value will be ignored. Try using Generic6DOFJoint3D instead. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_LOWER)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_LIMIT_LOWER)) {
|
||||
WARN_PRINT(vformat("Slider joint angular limits are not supported when using Jolt Physics. Any such value will be ignored. Try using Generic6DOFJoint3D instead. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_LIMIT_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint angular limit softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_LIMIT_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint angular limit restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_LIMIT_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_LIMIT_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint angular limit damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_MOTION_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_MOTION_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint angular motion softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_MOTION_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_MOTION_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint angular motion restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_MOTION_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_MOTION_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint angular motion damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_ORTHO_SOFTNESS)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_ORTHO_SOFTNESS)) {
|
||||
WARN_PRINT(vformat("Slider joint angular ortho softness is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_ORTHO_RESTITUTION)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_ORTHO_RESTITUTION)) {
|
||||
WARN_PRINT(vformat("Slider joint angular ortho restitution is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: {
|
||||
if (!Math::is_equal_approx(p_value, DEFAULT_ANGULAR_ORTHO_DAMPING)) {
|
||||
if (!Math::is_equal_approx(p_value, SLIDER_DEFAULT_ANGULAR_ORTHO_DAMPING)) {
|
||||
WARN_PRINT(vformat("Slider joint angular ortho damping is not supported when using Jolt Physics. Any such value will be ignored. This joint connects %s.", _bodies_to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -42,11 +42,11 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_WIND_FORCE_MAGNITUDE = 0.0;
|
||||
constexpr double DEFAULT_WIND_ATTENUATION_FACTOR = 0.0;
|
||||
constexpr double AREA_DEFAULT_WIND_MAGNITUDE = 0.0;
|
||||
constexpr double AREA_DEFAULT_WIND_ATTENUATION = 0.0;
|
||||
|
||||
const Vector3 DEFAULT_WIND_SOURCE = Vector3();
|
||||
const Vector3 DEFAULT_WIND_DIRECTION = Vector3();
|
||||
const Vector3 AREA_DEFAULT_WIND_SOURCE = Vector3();
|
||||
const Vector3 AREA_DEFAULT_WIND_DIRECTION = Vector3();
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -407,16 +407,16 @@ Variant JoltArea3D::get_param(PhysicsServer3D::AreaParameter p_param) const {
|
||||
return get_priority();
|
||||
}
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_FORCE_MAGNITUDE: {
|
||||
return DEFAULT_WIND_FORCE_MAGNITUDE;
|
||||
return AREA_DEFAULT_WIND_MAGNITUDE;
|
||||
}
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_SOURCE: {
|
||||
return DEFAULT_WIND_SOURCE;
|
||||
return AREA_DEFAULT_WIND_SOURCE;
|
||||
}
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_DIRECTION: {
|
||||
return DEFAULT_WIND_DIRECTION;
|
||||
return AREA_DEFAULT_WIND_DIRECTION;
|
||||
}
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_ATTENUATION_FACTOR: {
|
||||
return DEFAULT_WIND_ATTENUATION_FACTOR;
|
||||
return AREA_DEFAULT_WIND_ATTENUATION;
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(Variant(), vformat("Unhandled area parameter: '%d'. This should not happen. Please report this.", p_param));
|
||||
@ -457,22 +457,22 @@ void JoltArea3D::set_param(PhysicsServer3D::AreaParameter p_param, const Variant
|
||||
set_priority(p_value);
|
||||
} break;
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_FORCE_MAGNITUDE: {
|
||||
if (!Math::is_equal_approx((double)p_value, DEFAULT_WIND_FORCE_MAGNITUDE)) {
|
||||
if (!Math::is_equal_approx((double)p_value, AREA_DEFAULT_WIND_MAGNITUDE)) {
|
||||
WARN_PRINT(vformat("Invalid wind force magnitude for '%s'. Area wind force magnitude is not supported when using Jolt Physics. Any such value will be ignored.", to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_SOURCE: {
|
||||
if (!((Vector3)p_value).is_equal_approx(DEFAULT_WIND_SOURCE)) {
|
||||
if (!((Vector3)p_value).is_equal_approx(AREA_DEFAULT_WIND_SOURCE)) {
|
||||
WARN_PRINT(vformat("Invalid wind source for '%s'. Area wind source is not supported when using Jolt Physics. Any such value will be ignored.", to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_DIRECTION: {
|
||||
if (!((Vector3)p_value).is_equal_approx(DEFAULT_WIND_DIRECTION)) {
|
||||
if (!((Vector3)p_value).is_equal_approx(AREA_DEFAULT_WIND_DIRECTION)) {
|
||||
WARN_PRINT(vformat("Invalid wind direction for '%s'. Area wind direction is not supported when using Jolt Physics. Any such value will be ignored.", to_string()));
|
||||
}
|
||||
} break;
|
||||
case PhysicsServer3D::AREA_PARAM_WIND_ATTENUATION_FACTOR: {
|
||||
if (!Math::is_equal_approx((double)p_value, DEFAULT_WIND_ATTENUATION_FACTOR)) {
|
||||
if (!Math::is_equal_approx((double)p_value, AREA_DEFAULT_WIND_ATTENUATION)) {
|
||||
WARN_PRINT(vformat("Invalid wind attenuation for '%s'. Area wind attenuation is not supported when using Jolt Physics. Any such value will be ignored.", to_string()));
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -52,13 +52,13 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double DEFAULT_CONTACT_RECYCLE_RADIUS = 0.01;
|
||||
constexpr double DEFAULT_CONTACT_MAX_SEPARATION = 0.05;
|
||||
constexpr double DEFAULT_CONTACT_MAX_ALLOWED_PENETRATION = 0.01;
|
||||
constexpr double DEFAULT_CONTACT_DEFAULT_BIAS = 0.8;
|
||||
constexpr double DEFAULT_SLEEP_THRESHOLD_LINEAR = 0.1;
|
||||
constexpr double DEFAULT_SLEEP_THRESHOLD_ANGULAR = 8.0 * Math::PI / 180;
|
||||
constexpr double DEFAULT_SOLVER_ITERATIONS = 8;
|
||||
constexpr double SPACE_DEFAULT_CONTACT_RECYCLE_RADIUS = 0.01;
|
||||
constexpr double SPACE_DEFAULT_CONTACT_MAX_SEPARATION = 0.05;
|
||||
constexpr double SPACE_DEFAULT_CONTACT_MAX_ALLOWED_PENETRATION = 0.01;
|
||||
constexpr double SPACE_DEFAULT_CONTACT_DEFAULT_BIAS = 0.8;
|
||||
constexpr double SPACE_DEFAULT_SLEEP_THRESHOLD_LINEAR = 0.1;
|
||||
constexpr double SPACE_DEFAULT_SLEEP_THRESHOLD_ANGULAR = 8.0 * Math::PI / 180;
|
||||
constexpr double SPACE_DEFAULT_SOLVER_ITERATIONS = 8;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -209,28 +209,28 @@ void JoltSpace3D::call_queries() {
|
||||
double JoltSpace3D::get_param(PhysicsServer3D::SpaceParameter p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: {
|
||||
return DEFAULT_CONTACT_RECYCLE_RADIUS;
|
||||
return SPACE_DEFAULT_CONTACT_RECYCLE_RADIUS;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: {
|
||||
return DEFAULT_CONTACT_MAX_SEPARATION;
|
||||
return SPACE_DEFAULT_CONTACT_MAX_SEPARATION;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION: {
|
||||
return DEFAULT_CONTACT_MAX_ALLOWED_PENETRATION;
|
||||
return SPACE_DEFAULT_CONTACT_MAX_ALLOWED_PENETRATION;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_DEFAULT_BIAS: {
|
||||
return DEFAULT_CONTACT_DEFAULT_BIAS;
|
||||
return SPACE_DEFAULT_CONTACT_DEFAULT_BIAS;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: {
|
||||
return DEFAULT_SLEEP_THRESHOLD_LINEAR;
|
||||
return SPACE_DEFAULT_SLEEP_THRESHOLD_LINEAR;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: {
|
||||
return DEFAULT_SLEEP_THRESHOLD_ANGULAR;
|
||||
return SPACE_DEFAULT_SLEEP_THRESHOLD_ANGULAR;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: {
|
||||
return JoltProjectSettings::sleep_time_threshold;
|
||||
}
|
||||
case PhysicsServer3D::SPACE_PARAM_SOLVER_ITERATIONS: {
|
||||
return DEFAULT_SOLVER_ITERATIONS;
|
||||
return SPACE_DEFAULT_SOLVER_ITERATIONS;
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(0.0, vformat("Unhandled space parameter: '%d'. This should not happen. Please report this.", p_param));
|
||||
|
||||
@ -13,17 +13,17 @@
|
||||
|
||||
JPH_NAMESPACE_BEGIN
|
||||
|
||||
static inline const BodyLockInterface &sGetBodyLockInterface(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
static inline const BodyLockInterface &sCharacterGetBodyLockInterface(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
{
|
||||
return inLockBodies? static_cast<const BodyLockInterface &>(inSystem->GetBodyLockInterface()) : static_cast<const BodyLockInterface &>(inSystem->GetBodyLockInterfaceNoLock());
|
||||
}
|
||||
|
||||
static inline BodyInterface &sGetBodyInterface(PhysicsSystem *inSystem, bool inLockBodies)
|
||||
static inline BodyInterface &sCharacterGetBodyInterface(PhysicsSystem *inSystem, bool inLockBodies)
|
||||
{
|
||||
return inLockBodies? inSystem->GetBodyInterface() : inSystem->GetBodyInterfaceNoLock();
|
||||
}
|
||||
|
||||
static inline const NarrowPhaseQuery &sGetNarrowPhaseQuery(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
static inline const NarrowPhaseQuery &sCharacterGetNarrowPhaseQuery(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
{
|
||||
return inLockBodies? inSystem->GetNarrowPhaseQuery() : inSystem->GetNarrowPhaseQueryNoLock();
|
||||
}
|
||||
@ -54,17 +54,17 @@ Character::~Character()
|
||||
|
||||
void Character::AddToPhysicsSystem(EActivation inActivationMode, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).AddBody(mBodyID, inActivationMode);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).AddBody(mBodyID, inActivationMode);
|
||||
}
|
||||
|
||||
void Character::RemoveFromPhysicsSystem(bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).RemoveBody(mBodyID);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).RemoveBody(mBodyID);
|
||||
}
|
||||
|
||||
void Character::Activate(bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).ActivateBody(mBodyID);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).ActivateBody(mBodyID);
|
||||
}
|
||||
|
||||
void Character::CheckCollision(RMat44Arg inCenterOfMassTransform, Vec3Arg inMovementDirection, float inMaxSeparationDistance, const Shape *inShape, RVec3Arg inBaseOffset, CollideShapeCollector &ioCollector, bool inLockBodies) const
|
||||
@ -95,7 +95,7 @@ void Character::CheckCollision(RMat44Arg inCenterOfMassTransform, Vec3Arg inMove
|
||||
settings.mActiveEdgeMovementDirection = inMovementDirection;
|
||||
settings.mBackFaceMode = EBackFaceMode::IgnoreBackFaces;
|
||||
|
||||
sGetNarrowPhaseQuery(mSystem, inLockBodies).CollideShape(inShape, Vec3::sOne(), inCenterOfMassTransform, settings, inBaseOffset, ioCollector, broadphase_layer_filter, object_layer_filter, body_filter);
|
||||
sCharacterGetNarrowPhaseQuery(mSystem, inLockBodies).CollideShape(inShape, Vec3::sOne(), inCenterOfMassTransform, settings, inBaseOffset, ioCollector, broadphase_layer_filter, object_layer_filter, body_filter);
|
||||
}
|
||||
|
||||
void Character::CheckCollision(RVec3Arg inPosition, QuatArg inRotation, Vec3Arg inMovementDirection, float inMaxSeparationDistance, const Shape *inShape, RVec3Arg inBaseOffset, CollideShapeCollector &ioCollector, bool inLockBodies) const
|
||||
@ -112,7 +112,7 @@ void Character::CheckCollision(const Shape *inShape, float inMaxSeparationDistan
|
||||
RMat44 query_transform;
|
||||
Vec3 velocity;
|
||||
{
|
||||
BodyLockRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyID);
|
||||
BodyLockRead lock(sCharacterGetBodyLockInterface(mSystem, inLockBodies), mBodyID);
|
||||
if (!lock.Succeeded())
|
||||
return;
|
||||
|
||||
@ -133,7 +133,7 @@ void Character::PostSimulation(float inMaxSeparationDistance, bool inLockBodies)
|
||||
Quat char_rot;
|
||||
Vec3 char_vel;
|
||||
{
|
||||
BodyLockRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyID);
|
||||
BodyLockRead lock(sCharacterGetBodyLockInterface(mSystem, inLockBodies), mBodyID);
|
||||
if (!lock.Succeeded())
|
||||
return;
|
||||
const Body &body = lock.GetBody();
|
||||
@ -186,7 +186,7 @@ void Character::PostSimulation(float inMaxSeparationDistance, bool inLockBodies)
|
||||
mGroundNormal = collector.mGroundNormal;
|
||||
|
||||
// Get additional data from body
|
||||
BodyLockRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mGroundBodyID);
|
||||
BodyLockRead lock(sCharacterGetBodyLockInterface(mSystem, inLockBodies), mGroundBodyID);
|
||||
if (lock.Succeeded())
|
||||
{
|
||||
const Body &body = lock.GetBody();
|
||||
@ -216,74 +216,74 @@ void Character::PostSimulation(float inMaxSeparationDistance, bool inLockBodies)
|
||||
|
||||
void Character::SetLinearAndAngularVelocity(Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetLinearAndAngularVelocity(mBodyID, inLinearVelocity, inAngularVelocity);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetLinearAndAngularVelocity(mBodyID, inLinearVelocity, inAngularVelocity);
|
||||
}
|
||||
|
||||
Vec3 Character::GetLinearVelocity(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetLinearVelocity(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetLinearVelocity(mBodyID);
|
||||
}
|
||||
|
||||
void Character::SetLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetLinearVelocity(mBodyID, inLinearVelocity);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetLinearVelocity(mBodyID, inLinearVelocity);
|
||||
}
|
||||
|
||||
void Character::AddLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).AddLinearVelocity(mBodyID, inLinearVelocity);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).AddLinearVelocity(mBodyID, inLinearVelocity);
|
||||
}
|
||||
|
||||
void Character::AddImpulse(Vec3Arg inImpulse, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).AddImpulse(mBodyID, inImpulse);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).AddImpulse(mBodyID, inImpulse);
|
||||
}
|
||||
|
||||
void Character::GetPositionAndRotation(RVec3 &outPosition, Quat &outRotation, bool inLockBodies) const
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).GetPositionAndRotation(mBodyID, outPosition, outRotation);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).GetPositionAndRotation(mBodyID, outPosition, outRotation);
|
||||
}
|
||||
|
||||
void Character::SetPositionAndRotation(RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode, bool inLockBodies) const
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetPositionAndRotation(mBodyID, inPosition, inRotation, inActivationMode);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetPositionAndRotation(mBodyID, inPosition, inRotation, inActivationMode);
|
||||
}
|
||||
|
||||
RVec3 Character::GetPosition(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetPosition(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetPosition(mBodyID);
|
||||
}
|
||||
|
||||
void Character::SetPosition(RVec3Arg inPosition, EActivation inActivationMode, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetPosition(mBodyID, inPosition, inActivationMode);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetPosition(mBodyID, inPosition, inActivationMode);
|
||||
}
|
||||
|
||||
Quat Character::GetRotation(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetRotation(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetRotation(mBodyID);
|
||||
}
|
||||
|
||||
void Character::SetRotation(QuatArg inRotation, EActivation inActivationMode, bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetRotation(mBodyID, inRotation, inActivationMode);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetRotation(mBodyID, inRotation, inActivationMode);
|
||||
}
|
||||
|
||||
RVec3 Character::GetCenterOfMassPosition(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetCenterOfMassPosition(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetCenterOfMassPosition(mBodyID);
|
||||
}
|
||||
|
||||
RMat44 Character::GetWorldTransform(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetWorldTransform(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetWorldTransform(mBodyID);
|
||||
}
|
||||
|
||||
void Character::SetLayer(ObjectLayer inLayer, bool inLockBodies)
|
||||
{
|
||||
mLayer = inLayer;
|
||||
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetObjectLayer(mBodyID, inLayer);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetObjectLayer(mBodyID, inLayer);
|
||||
}
|
||||
|
||||
bool Character::SetShape(const Shape *inShape, float inMaxPenetrationDepth, bool inLockBodies)
|
||||
@ -321,13 +321,13 @@ bool Character::SetShape(const Shape *inShape, float inMaxPenetrationDepth, bool
|
||||
|
||||
// Switch the shape
|
||||
mShape = inShape;
|
||||
sGetBodyInterface(mSystem, inLockBodies).SetShape(mBodyID, mShape, false, EActivation::Activate);
|
||||
sCharacterGetBodyInterface(mSystem, inLockBodies).SetShape(mBodyID, mShape, false, EActivation::Activate);
|
||||
return true;
|
||||
}
|
||||
|
||||
TransformedShape Character::GetTransformedShape(bool inLockBodies) const
|
||||
{
|
||||
return sGetBodyInterface(mSystem, inLockBodies).GetTransformedShape(mBodyID);
|
||||
return sCharacterGetBodyInterface(mSystem, inLockBodies).GetTransformedShape(mBodyID);
|
||||
}
|
||||
|
||||
JPH_NAMESPACE_END
|
||||
|
||||
@ -38,12 +38,12 @@ JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(RagdollSettings)
|
||||
JPH_ADD_ATTRIBUTE(RagdollSettings, mAdditionalConstraints)
|
||||
}
|
||||
|
||||
static inline BodyInterface &sGetBodyInterface(PhysicsSystem *inSystem, bool inLockBodies)
|
||||
static inline BodyInterface &sRagdollGetBodyInterface(PhysicsSystem *inSystem, bool inLockBodies)
|
||||
{
|
||||
return inLockBodies? inSystem->GetBodyInterface() : inSystem->GetBodyInterfaceNoLock();
|
||||
}
|
||||
|
||||
static inline const BodyLockInterface &sGetBodyLockInterface(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
static inline const BodyLockInterface &sRagdollGetBodyLockInterface(const PhysicsSystem *inSystem, bool inLockBodies)
|
||||
{
|
||||
return inLockBodies? static_cast<const BodyLockInterface &>(inSystem->GetBodyLockInterface()) : static_cast<const BodyLockInterface &>(inSystem->GetBodyLockInterfaceNoLock());
|
||||
}
|
||||
@ -476,7 +476,7 @@ void Ragdoll::AddToPhysicsSystem(EActivation inActivationMode, bool inLockBodies
|
||||
memcpy(bodies, mBodyIDs.data(), num_bodies * sizeof(BodyID));
|
||||
|
||||
// Insert bodies as a batch
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface::AddState add_state = bi.AddBodiesPrepare(bodies, num_bodies);
|
||||
bi.AddBodiesFinalize(bodies, num_bodies, add_state, inActivationMode);
|
||||
}
|
||||
@ -498,20 +498,20 @@ void Ragdoll::RemoveFromPhysicsSystem(bool inLockBodies)
|
||||
memcpy(bodies, mBodyIDs.data(), num_bodies * sizeof(BodyID));
|
||||
|
||||
// Remove all bodies as a batch
|
||||
sGetBodyInterface(mSystem, inLockBodies).RemoveBodies(bodies, num_bodies);
|
||||
sRagdollGetBodyInterface(mSystem, inLockBodies).RemoveBodies(bodies, num_bodies);
|
||||
}
|
||||
}
|
||||
|
||||
void Ragdoll::Activate(bool inLockBodies)
|
||||
{
|
||||
sGetBodyInterface(mSystem, inLockBodies).ActivateBodies(mBodyIDs.data(), (int)mBodyIDs.size());
|
||||
sRagdollGetBodyInterface(mSystem, inLockBodies).ActivateBodies(mBodyIDs.data(), (int)mBodyIDs.size());
|
||||
}
|
||||
|
||||
bool Ragdoll::IsActive(bool inLockBodies) const
|
||||
{
|
||||
// Lock the bodies
|
||||
int body_count = (int)mBodyIDs.size();
|
||||
BodyLockMultiRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
BodyLockMultiRead lock(sRagdollGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
|
||||
// Test if any body is active
|
||||
for (int b = 0; b < body_count; ++b)
|
||||
@ -528,7 +528,7 @@ void Ragdoll::SetGroupID(CollisionGroup::GroupID inGroupID, bool inLockBodies)
|
||||
{
|
||||
// Lock the bodies
|
||||
int body_count = (int)mBodyIDs.size();
|
||||
BodyLockMultiWrite lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
BodyLockMultiWrite lock(sRagdollGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
|
||||
// Update group ID
|
||||
for (int b = 0; b < body_count; ++b)
|
||||
@ -548,7 +548,7 @@ void Ragdoll::SetPose(const SkeletonPose &inPose, bool inLockBodies)
|
||||
void Ragdoll::SetPose(RVec3Arg inRootOffset, const Mat44 *inJointMatrices, bool inLockBodies)
|
||||
{
|
||||
// Move bodies instantly into the correct position
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (int i = 0; i < (int)mBodyIDs.size(); ++i)
|
||||
{
|
||||
const Mat44 &joint = inJointMatrices[i];
|
||||
@ -571,7 +571,7 @@ void Ragdoll::GetPose(RVec3 &outRootOffset, Mat44 *outJointMatrices, bool inLock
|
||||
int body_count = (int)mBodyIDs.size();
|
||||
if (body_count == 0)
|
||||
return;
|
||||
BodyLockMultiRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
BodyLockMultiRead lock(sRagdollGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
|
||||
// Get root matrix
|
||||
const Body *root = lock.GetBody(0);
|
||||
@ -604,7 +604,7 @@ void Ragdoll::DriveToPoseUsingKinematics(const SkeletonPose &inPose, float inDel
|
||||
void Ragdoll::DriveToPoseUsingKinematics(RVec3Arg inRootOffset, const Mat44 *inJointMatrices, float inDeltaTime, bool inLockBodies)
|
||||
{
|
||||
// Move bodies into the correct position using kinematics
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (int i = 0; i < (int)mBodyIDs.size(); ++i)
|
||||
{
|
||||
const Mat44 &joint = inJointMatrices[i];
|
||||
@ -643,35 +643,35 @@ void Ragdoll::DriveToPoseUsingMotors(const SkeletonPose &inPose)
|
||||
|
||||
void Ragdoll::SetLinearAndAngularVelocity(Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity, bool inLockBodies)
|
||||
{
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (BodyID body_id : mBodyIDs)
|
||||
bi.SetLinearAndAngularVelocity(body_id, inLinearVelocity, inAngularVelocity);
|
||||
}
|
||||
|
||||
void Ragdoll::SetLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies)
|
||||
{
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (BodyID body_id : mBodyIDs)
|
||||
bi.SetLinearVelocity(body_id, inLinearVelocity);
|
||||
}
|
||||
|
||||
void Ragdoll::AddLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies)
|
||||
{
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (BodyID body_id : mBodyIDs)
|
||||
bi.AddLinearVelocity(body_id, inLinearVelocity);
|
||||
}
|
||||
|
||||
void Ragdoll::AddImpulse(Vec3Arg inImpulse, bool inLockBodies)
|
||||
{
|
||||
BodyInterface &bi = sGetBodyInterface(mSystem, inLockBodies);
|
||||
BodyInterface &bi = sRagdollGetBodyInterface(mSystem, inLockBodies);
|
||||
for (BodyID body_id : mBodyIDs)
|
||||
bi.AddImpulse(body_id, inImpulse);
|
||||
}
|
||||
|
||||
void Ragdoll::GetRootTransform(RVec3 &outPosition, Quat &outRotation, bool inLockBodies) const
|
||||
{
|
||||
BodyLockRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs[0]);
|
||||
BodyLockRead lock(sRagdollGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs[0]);
|
||||
if (lock.Succeeded())
|
||||
{
|
||||
const Body &body = lock.GetBody();
|
||||
@ -689,7 +689,7 @@ AABox Ragdoll::GetWorldSpaceBounds(bool inLockBodies) const
|
||||
{
|
||||
// Lock the bodies
|
||||
int body_count = (int)mBodyIDs.size();
|
||||
BodyLockMultiRead lock(sGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
BodyLockMultiRead lock(sRagdollGetBodyLockInterface(mSystem, inLockBodies), mBodyIDs.data(), body_count);
|
||||
|
||||
// Encapsulate all bodies
|
||||
AABox bounds;
|
||||
|
||||
Reference in New Issue
Block a user