summaryrefslogtreecommitdiff
path: root/servers/physics_3d/joints
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:41:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 21:57:34 +0200
commit0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch)
tree198d4ff7665d89307f6ca2469fa38620a9eb1672 /servers/physics_3d/joints
parent07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff)
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'servers/physics_3d/joints')
-rw-r--r--servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp16
-rw-r--r--servers/physics_3d/joints/pin_joint_3d_sw.cpp6
2 files changed, 14 insertions, 8 deletions
diff --git a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp
index 97310a5924..423bbc0dfd 100644
--- a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp
+++ b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp
@@ -83,8 +83,9 @@ int G6DOFRotationalLimitMotor3DSW::testLimitValue(real_t test_value) {
real_t G6DOFRotationalLimitMotor3DSW::solveAngularLimits(
real_t timeStep, Vector3 &axis, real_t jacDiagABInv,
Body3DSW *body0, Body3DSW *body1) {
- if (!needApplyTorques())
+ if (!needApplyTorques()) {
return 0.0f;
+ }
real_t target_velocity = m_targetVelocity;
real_t maxMotorForce = m_maxMotorForce;
@@ -138,8 +139,9 @@ real_t G6DOFRotationalLimitMotor3DSW::solveAngularLimits(
Vector3 motorImp = clippedMotorImpulse * axis;
body0->apply_torque_impulse(motorImp);
- if (body1)
+ if (body1) {
body1->apply_torque_impulse(-motorImp);
+ }
return clippedMotorImpulse;
}
@@ -325,10 +327,11 @@ bool Generic6DOFJoint3DSW::setup(real_t p_timestep) {
//linear part
for (i = 0; i < 3; i++) {
if (m_linearLimits.enable_limit[i] && m_linearLimits.isLimited(i)) {
- if (m_useLinearReferenceFrameA)
+ if (m_useLinearReferenceFrameA) {
normalWorld = m_calculatedTransformA.basis.get_axis(i);
- else
+ } else {
normalWorld = m_calculatedTransformB.basis.get_axis(i);
+ }
buildLinearJacobian(
m_jacLinear[i], normalWorld,
@@ -367,10 +370,11 @@ void Generic6DOFJoint3DSW::solve(real_t p_timestep) {
if (m_linearLimits.enable_limit[i] && m_linearLimits.isLimited(i)) {
jacDiagABInv = real_t(1.) / m_jacLinear[i].getDiagonal();
- if (m_useLinearReferenceFrameA)
+ if (m_useLinearReferenceFrameA) {
linear_axis = m_calculatedTransformA.basis.get_axis(i);
- else
+ } else {
linear_axis = m_calculatedTransformB.basis.get_axis(i);
+ }
m_linearLimits.solveLinearAxis(
m_timeStep,
diff --git a/servers/physics_3d/joints/pin_joint_3d_sw.cpp b/servers/physics_3d/joints/pin_joint_3d_sw.cpp
index 3f3c0f367d..230904408b 100644
--- a/servers/physics_3d/joints/pin_joint_3d_sw.cpp
+++ b/servers/physics_3d/joints/pin_joint_3d_sw.cpp
@@ -109,10 +109,12 @@ void PinJoint3DSW::solve(real_t p_step) {
real_t impulseClamp = m_impulseClamp;
if (impulseClamp > 0) {
- if (impulse < -impulseClamp)
+ if (impulse < -impulseClamp) {
impulse = -impulseClamp;
- if (impulse > impulseClamp)
+ }
+ if (impulse > impulseClamp) {
impulse = impulseClamp;
+ }
}
m_appliedImpulse += impulse;