Browse Source

Merge pull request #19169 from BastiaanOlij/fix_zero_roll_influence

Check for 0 roll influence
Rémi Verschelde 7 years ago
parent
commit
a71b0830ab
1 changed files with 7 additions and 4 deletions
  1. 7 4
      scene/3d/vehicle_body.cpp

+ 7 - 4
scene/3d/vehicle_body.cpp

@@ -583,11 +583,14 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
 	rel_vel = normal.dot(vel);
 
 	// !BAS! We had this set to 0.4, in bullet its 0.2
-	// real_t contactDamping = real_t(0.2);
+	real_t contactDamping = real_t(0.2);
+
+	if (p_rollInfluence > 0.0) {
+		// !BAS! But seeing we apply this frame by frame, makes more sense to me to make this time based
+		// keeping in mind our anti roll factor if it is set
+		contactDamping = s->get_step() / p_rollInfluence;
+	}
 
-	// !BAS! But seeing we apply this frame by frame, makes more sense to me to make this time based
-	// keeping in mind our anti roll factor
-	real_t contactDamping = s->get_step() / p_rollInfluence;
 #define ONLY_USE_LINEAR_MASS
 #ifdef ONLY_USE_LINEAR_MASS
 	real_t massTerm = real_t(1.) / ((1.0 / mass) + b2invmass);