From 5a1279af8ad22e2ccedaebbdcfb4e3ec561c6d8c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 6 Aug 2015 21:48:50 -0700 Subject: BulletSim: clean up some code for axis locking. No functional change. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 87 ++++---------------------- 1 file changed, 13 insertions(+), 74 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 5d359e8..a00991f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1668,98 +1668,37 @@ public class BSPrim : BSPhysObject { switch ((int)funct) { + // Those that take no parameters case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z, 0f, 0f); - index += 1; - break; - case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z, (float)pParams[index + 1], (float)pParams[index + 2]); - index += 3; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z, 0f, 0f); - index += 1; - break; case ExtendedPhysics.PHYS_AXIS_UNLOCK: - ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK, 0f, 0f); + ApplyAxisLimits((int)funct, 0f, 0f); index += 1; break; + // Those that take two parameters (the limits) + case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X: + case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y: + case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z: + case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X: + case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y: + case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z: + ApplyAxisLimits((int)funct, (float)pParams[index + 1], (float)pParams[index + 2]); + index += 3; + break; default: m_log.WarnFormat("{0} SetSxisLockLimitsExtension. Unknown op={1}", LogHeader, funct); index += 1; @@ -1789,7 +1728,7 @@ public class BSPrim : BSPhysObject float linearMax = 23000f; float angularMax = (float)Math.PI; - switch ((int)funct) + switch (funct) { case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR: this.LockedLinearAxis = new OMV.Vector3(LockedAxis, LockedAxis, LockedAxis); -- cgit v1.1