diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 339 |
1 files changed, 321 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index c88a5c2..5d359e8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -34,6 +34,7 @@ using OMV = OpenMetaverse; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Region.Physics.Manager; | 35 | using OpenSim.Region.Physics.Manager; |
36 | using OpenSim.Region.Physics.ConvexDecompositionDotNet; | 36 | using OpenSim.Region.Physics.ConvexDecompositionDotNet; |
37 | using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics | ||
37 | 38 | ||
38 | namespace OpenSim.Region.Physics.BulletSPlugin | 39 | namespace OpenSim.Region.Physics.BulletSPlugin |
39 | { | 40 | { |
@@ -95,11 +96,9 @@ public class BSPrim : BSPhysObject | |||
95 | _isPhysical = pisPhysical; | 96 | _isPhysical = pisPhysical; |
96 | _isVolumeDetect = false; | 97 | _isVolumeDetect = false; |
97 | 98 | ||
98 | // Add a dynamic vehicle to our set of actors that can move this prim. | ||
99 | // PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName)); | ||
100 | |||
101 | _mass = CalculateMass(); | 99 | _mass = CalculateMass(); |
102 | 100 | ||
101 | DetailLog("{0},BSPrim.constructor,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(pbs)); | ||
103 | // DetailLog("{0},BSPrim.constructor,call", LocalID); | 102 | // DetailLog("{0},BSPrim.constructor,call", LocalID); |
104 | // do the actual object creation at taint time | 103 | // do the actual object creation at taint time |
105 | PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate() | 104 | PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate() |
@@ -167,6 +166,7 @@ public class BSPrim : BSPhysObject | |||
167 | public override PrimitiveBaseShape Shape { | 166 | public override PrimitiveBaseShape Shape { |
168 | set { | 167 | set { |
169 | BaseShape = value; | 168 | BaseShape = value; |
169 | DetailLog("{0},BSPrim.changeShape,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(BaseShape)); | ||
170 | PrimAssetState = PrimAssetCondition.Unknown; | 170 | PrimAssetState = PrimAssetCondition.Unknown; |
171 | ForceBodyShapeRebuild(false); | 171 | ForceBodyShapeRebuild(false); |
172 | } | 172 | } |
@@ -285,23 +285,21 @@ public class BSPrim : BSPhysObject | |||
285 | { | 285 | { |
286 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); | 286 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
287 | 287 | ||
288 | // "1" means free, "0" means locked | 288 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f); |
289 | OMV.Vector3 locking = LockedAxisFree; | 289 | if (axis.X != 1) |
290 | if (axis.X != 1) locking.X = 0f; | ||
291 | if (axis.Y != 1) locking.Y = 0f; | ||
292 | if (axis.Z != 1) locking.Z = 0f; | ||
293 | LockedAngularAxis = locking; | ||
294 | |||
295 | EnableActor(LockedAngularAxis != LockedAxisFree, LockedAxisActorName, delegate() | ||
296 | { | 290 | { |
297 | return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); | 291 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X, 0f, 0f); |
298 | }); | 292 | } |
299 | 293 | if (axis.Y != 1) | |
300 | // Update parameters so the new actor's Refresh() action is called at the right time. | ||
301 | PhysScene.TaintedObject(LocalID, "BSPrim.LockAngularMotion", delegate() | ||
302 | { | 294 | { |
303 | UpdatePhysicalParameters(); | 295 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y, 0f, 0f); |
304 | }); | 296 | } |
297 | if (axis.Z != 1) | ||
298 | { | ||
299 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z, 0f, 0f); | ||
300 | } | ||
301 | |||
302 | InitializeAxisActor(); | ||
305 | 303 | ||
306 | return; | 304 | return; |
307 | } | 305 | } |
@@ -533,6 +531,12 @@ public class BSPrim : BSPhysObject | |||
533 | { | 531 | { |
534 | return new BSActorSetForce(PhysScene, this, SetForceActorName); | 532 | return new BSActorSetForce(PhysScene, this, SetForceActorName); |
535 | }); | 533 | }); |
534 | |||
535 | // Call update so actor Refresh() is called to start things off | ||
536 | PhysScene.TaintedObject(LocalID, "BSPrim.setForce", delegate() | ||
537 | { | ||
538 | UpdatePhysicalParameters(); | ||
539 | }); | ||
536 | } | 540 | } |
537 | } | 541 | } |
538 | 542 | ||
@@ -766,6 +770,12 @@ public class BSPrim : BSPhysObject | |||
766 | return new BSActorSetTorque(PhysScene, this, SetTorqueActorName); | 770 | return new BSActorSetTorque(PhysScene, this, SetTorqueActorName); |
767 | }); | 771 | }); |
768 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque); | 772 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque); |
773 | |||
774 | // Call update so actor Refresh() is called to start things off | ||
775 | PhysScene.TaintedObject(LocalID, "BSPrim.setTorque", delegate() | ||
776 | { | ||
777 | UpdatePhysicalParameters(); | ||
778 | }); | ||
769 | } | 779 | } |
770 | } | 780 | } |
771 | public override OMV.Vector3 Acceleration { | 781 | public override OMV.Vector3 Acceleration { |
@@ -1138,6 +1148,12 @@ public class BSPrim : BSPhysObject | |||
1138 | { | 1148 | { |
1139 | return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); | 1149 | return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); |
1140 | }); | 1150 | }); |
1151 | |||
1152 | // Call update so actor Refresh() is called to start things off | ||
1153 | PhysScene.TaintedObject(LocalID, "BSPrim.PIDActive", delegate() | ||
1154 | { | ||
1155 | UpdatePhysicalParameters(); | ||
1156 | }); | ||
1141 | } | 1157 | } |
1142 | } | 1158 | } |
1143 | 1159 | ||
@@ -1164,6 +1180,12 @@ public class BSPrim : BSPhysObject | |||
1164 | { | 1180 | { |
1165 | return new BSActorHover(PhysScene, this, HoverActorName); | 1181 | return new BSActorHover(PhysScene, this, HoverActorName); |
1166 | }); | 1182 | }); |
1183 | |||
1184 | // Call update so actor Refresh() is called to start things off | ||
1185 | PhysScene.TaintedObject(LocalID, "BSPrim.PIDHoverActive", delegate() | ||
1186 | { | ||
1187 | UpdatePhysicalParameters(); | ||
1188 | }); | ||
1167 | } | 1189 | } |
1168 | } | 1190 | } |
1169 | 1191 | ||
@@ -1601,12 +1623,293 @@ public class BSPrim : BSPhysObject | |||
1601 | object ret = null; | 1623 | object ret = null; |
1602 | switch (pFunct) | 1624 | switch (pFunct) |
1603 | { | 1625 | { |
1626 | case ExtendedPhysics.PhysFunctAxisLockLimits: | ||
1627 | ret = SetAxisLockLimitsExtension(pParams); | ||
1628 | break; | ||
1604 | default: | 1629 | default: |
1605 | ret = base.Extension(pFunct, pParams); | 1630 | ret = base.Extension(pFunct, pParams); |
1606 | break; | 1631 | break; |
1607 | } | 1632 | } |
1608 | return ret; | 1633 | return ret; |
1609 | } | 1634 | } |
1635 | |||
1636 | private void InitializeAxisActor() | ||
1637 | { | ||
1638 | EnableActor(LockedAngularAxis != LockedAxisFree || LockedLinearAxis != LockedAxisFree, | ||
1639 | LockedAxisActorName, delegate() | ||
1640 | { | ||
1641 | return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); | ||
1642 | }); | ||
1643 | |||
1644 | // Update parameters so the new actor's Refresh() action is called at the right time. | ||
1645 | PhysScene.TaintedObject(LocalID, "BSPrim.LockAxis", delegate() | ||
1646 | { | ||
1647 | UpdatePhysicalParameters(); | ||
1648 | }); | ||
1649 | } | ||
1650 | |||
1651 | // Passed an array of an array of parameters, set the axis locking. | ||
1652 | // This expects an int (PHYS_AXIS_*) followed by none or two limit floats | ||
1653 | // followed by another int and floats, etc. | ||
1654 | private object SetAxisLockLimitsExtension(object[] pParams) | ||
1655 | { | ||
1656 | DetailLog("{0} SetAxisLockLimitsExtension. parmlen={1}", LocalID, pParams.GetLength(0)); | ||
1657 | object ret = null; | ||
1658 | try | ||
1659 | { | ||
1660 | if (pParams.GetLength(0) > 1) | ||
1661 | { | ||
1662 | int index = 2; | ||
1663 | while (index < pParams.GetLength(0)) | ||
1664 | { | ||
1665 | var funct = pParams[index]; | ||
1666 | DetailLog("{0} SetAxisLockLimitsExtension. op={1}, index={2}", LocalID, funct, index); | ||
1667 | if (funct is Int32 || funct is Int64) | ||
1668 | { | ||
1669 | switch ((int)funct) | ||
1670 | { | ||
1671 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR: | ||
1672 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR, 0f, 0f); | ||
1673 | index += 1; | ||
1674 | break; | ||
1675 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X: | ||
1676 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X, 0f, 0f); | ||
1677 | index += 1; | ||
1678 | break; | ||
1679 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X: | ||
1680 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1681 | index += 3; | ||
1682 | break; | ||
1683 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y: | ||
1684 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y, 0f, 0f); | ||
1685 | index += 1; | ||
1686 | break; | ||
1687 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y: | ||
1688 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1689 | index += 3; | ||
1690 | break; | ||
1691 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z: | ||
1692 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z, 0f, 0f); | ||
1693 | index += 1; | ||
1694 | break; | ||
1695 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z: | ||
1696 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1697 | index += 3; | ||
1698 | break; | ||
1699 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR: | ||
1700 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR, 0f, 0f); | ||
1701 | index += 1; | ||
1702 | break; | ||
1703 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X: | ||
1704 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X, 0f, 0f); | ||
1705 | index += 1; | ||
1706 | break; | ||
1707 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X: | ||
1708 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1709 | index += 3; | ||
1710 | break; | ||
1711 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y: | ||
1712 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y, 0f, 0f); | ||
1713 | index += 1; | ||
1714 | break; | ||
1715 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y: | ||
1716 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1717 | index += 3; | ||
1718 | break; | ||
1719 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z: | ||
1720 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z, 0f, 0f); | ||
1721 | index += 1; | ||
1722 | break; | ||
1723 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z: | ||
1724 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z, (float)pParams[index + 1], (float)pParams[index + 2]); | ||
1725 | index += 3; | ||
1726 | break; | ||
1727 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR: | ||
1728 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR, 0f, 0f); | ||
1729 | index += 1; | ||
1730 | break; | ||
1731 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X: | ||
1732 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X, 0f, 0f); | ||
1733 | index += 1; | ||
1734 | break; | ||
1735 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y: | ||
1736 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y, 0f, 0f); | ||
1737 | index += 1; | ||
1738 | break; | ||
1739 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z: | ||
1740 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z, 0f, 0f); | ||
1741 | index += 1; | ||
1742 | break; | ||
1743 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR: | ||
1744 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f); | ||
1745 | index += 1; | ||
1746 | break; | ||
1747 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X: | ||
1748 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X, 0f, 0f); | ||
1749 | index += 1; | ||
1750 | break; | ||
1751 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y: | ||
1752 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y, 0f, 0f); | ||
1753 | index += 1; | ||
1754 | break; | ||
1755 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z: | ||
1756 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z, 0f, 0f); | ||
1757 | index += 1; | ||
1758 | break; | ||
1759 | case ExtendedPhysics.PHYS_AXIS_UNLOCK: | ||
1760 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK, 0f, 0f); | ||
1761 | index += 1; | ||
1762 | break; | ||
1763 | default: | ||
1764 | m_log.WarnFormat("{0} SetSxisLockLimitsExtension. Unknown op={1}", LogHeader, funct); | ||
1765 | index += 1; | ||
1766 | break; | ||
1767 | } | ||
1768 | } | ||
1769 | } | ||
1770 | InitializeAxisActor(); | ||
1771 | ret = (object)index; | ||
1772 | } | ||
1773 | } | ||
1774 | catch (Exception e) | ||
1775 | { | ||
1776 | m_log.WarnFormat("{0} SetSxisLockLimitsExtension exception in object {1}: {2}", LogHeader, this.Name, e); | ||
1777 | ret = null; | ||
1778 | } | ||
1779 | return ret; // not implemented yet | ||
1780 | } | ||
1781 | |||
1782 | // Set the locking parameters. | ||
1783 | // If an axis is locked, the limits for the axis are set to zero, | ||
1784 | // If the axis is being constrained, the high and low value are passed and set. | ||
1785 | // When done here, LockedXXXAxis flags are set and LockedXXXAxixLow/High are set to the range. | ||
1786 | protected void ApplyAxisLimits(int funct, float low, float high) | ||
1787 | { | ||
1788 | DetailLog("{0} ApplyAxisLimits. op={1}, low={2}, high={3}", LocalID, funct, low, high); | ||
1789 | float linearMax = 23000f; | ||
1790 | float angularMax = (float)Math.PI; | ||
1791 | |||
1792 | switch ((int)funct) | ||
1793 | { | ||
1794 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR: | ||
1795 | this.LockedLinearAxis = new OMV.Vector3(LockedAxis, LockedAxis, LockedAxis); | ||
1796 | this.LockedLinearAxisLow = OMV.Vector3.Zero; | ||
1797 | this.LockedLinearAxisHigh = OMV.Vector3.Zero; | ||
1798 | break; | ||
1799 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X: | ||
1800 | this.LockedLinearAxis.X = LockedAxis; | ||
1801 | this.LockedLinearAxisLow.X = 0f; | ||
1802 | this.LockedLinearAxisHigh.X = 0f; | ||
1803 | break; | ||
1804 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X: | ||
1805 | this.LockedLinearAxis.X = LockedAxis; | ||
1806 | this.LockedLinearAxisLow.X = Util.Clip(low, -linearMax, linearMax); | ||
1807 | this.LockedLinearAxisHigh.X = Util.Clip(high, -linearMax, linearMax); | ||
1808 | break; | ||
1809 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y: | ||
1810 | this.LockedLinearAxis.Y = LockedAxis; | ||
1811 | this.LockedLinearAxisLow.Y = 0f; | ||
1812 | this.LockedLinearAxisHigh.Y = 0f; | ||
1813 | break; | ||
1814 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y: | ||
1815 | this.LockedLinearAxis.Y = LockedAxis; | ||
1816 | this.LockedLinearAxisLow.Y = Util.Clip(low, -linearMax, linearMax); | ||
1817 | this.LockedLinearAxisHigh.Y = Util.Clip(high, -linearMax, linearMax); | ||
1818 | break; | ||
1819 | case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z: | ||
1820 | this.LockedLinearAxis.Z = LockedAxis; | ||
1821 | this.LockedLinearAxisLow.Z = 0f; | ||
1822 | this.LockedLinearAxisHigh.Z = 0f; | ||
1823 | break; | ||
1824 | case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z: | ||
1825 | this.LockedLinearAxis.Z = LockedAxis; | ||
1826 | this.LockedLinearAxisLow.Z = Util.Clip(low, -linearMax, linearMax); | ||
1827 | this.LockedLinearAxisHigh.Z = Util.Clip(high, -linearMax, linearMax); | ||
1828 | break; | ||
1829 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR: | ||
1830 | this.LockedAngularAxis = new OMV.Vector3(LockedAxis, LockedAxis, LockedAxis); | ||
1831 | this.LockedAngularAxisLow = OMV.Vector3.Zero; | ||
1832 | this.LockedAngularAxisHigh = OMV.Vector3.Zero; | ||
1833 | break; | ||
1834 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X: | ||
1835 | this.LockedAngularAxis.X = LockedAxis; | ||
1836 | this.LockedAngularAxisLow.X = 0; | ||
1837 | this.LockedAngularAxisHigh.X = 0; | ||
1838 | break; | ||
1839 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X: | ||
1840 | this.LockedAngularAxis.X = LockedAxis; | ||
1841 | this.LockedAngularAxisLow.X = Util.Clip(low, -angularMax, angularMax); | ||
1842 | this.LockedAngularAxisHigh.X = Util.Clip(high, -angularMax, angularMax); | ||
1843 | break; | ||
1844 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y: | ||
1845 | this.LockedAngularAxis.Y = LockedAxis; | ||
1846 | this.LockedAngularAxisLow.Y = 0; | ||
1847 | this.LockedAngularAxisHigh.Y = 0; | ||
1848 | break; | ||
1849 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y: | ||
1850 | this.LockedAngularAxis.Y = LockedAxis; | ||
1851 | this.LockedAngularAxisLow.Y = Util.Clip(low, -angularMax, angularMax); | ||
1852 | this.LockedAngularAxisHigh.Y = Util.Clip(high, -angularMax, angularMax); | ||
1853 | break; | ||
1854 | case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z: | ||
1855 | this.LockedAngularAxis.Z = LockedAxis; | ||
1856 | this.LockedAngularAxisLow.Z = 0; | ||
1857 | this.LockedAngularAxisHigh.Z = 0; | ||
1858 | break; | ||
1859 | case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z: | ||
1860 | this.LockedAngularAxis.Z = LockedAxis; | ||
1861 | this.LockedAngularAxisLow.Z = Util.Clip(low, -angularMax, angularMax); | ||
1862 | this.LockedAngularAxisHigh.Z = Util.Clip(high, -angularMax, angularMax); | ||
1863 | break; | ||
1864 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR: | ||
1865 | this.LockedLinearAxis = LockedAxisFree; | ||
1866 | this.LockedLinearAxisLow = new OMV.Vector3(-linearMax, -linearMax, -linearMax); | ||
1867 | this.LockedLinearAxisHigh = new OMV.Vector3(linearMax, linearMax, linearMax); | ||
1868 | break; | ||
1869 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X: | ||
1870 | this.LockedLinearAxis.X = FreeAxis; | ||
1871 | this.LockedLinearAxisLow.X = -linearMax; | ||
1872 | this.LockedLinearAxisHigh.X = linearMax; | ||
1873 | break; | ||
1874 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y: | ||
1875 | this.LockedLinearAxis.Y = FreeAxis; | ||
1876 | this.LockedLinearAxisLow.Y = -linearMax; | ||
1877 | this.LockedLinearAxisHigh.Y = linearMax; | ||
1878 | break; | ||
1879 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z: | ||
1880 | this.LockedLinearAxis.Z = FreeAxis; | ||
1881 | this.LockedLinearAxisLow.Z = -linearMax; | ||
1882 | this.LockedLinearAxisHigh.Z = linearMax; | ||
1883 | break; | ||
1884 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR: | ||
1885 | this.LockedAngularAxis = LockedAxisFree; | ||
1886 | this.LockedAngularAxisLow = new OMV.Vector3(-angularMax, -angularMax, -angularMax); | ||
1887 | this.LockedAngularAxisHigh = new OMV.Vector3(angularMax, angularMax, angularMax); | ||
1888 | break; | ||
1889 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X: | ||
1890 | this.LockedAngularAxis.X = FreeAxis; | ||
1891 | this.LockedAngularAxisLow.X = -angularMax; | ||
1892 | this.LockedAngularAxisHigh.X = angularMax; | ||
1893 | break; | ||
1894 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y: | ||
1895 | this.LockedAngularAxis.Y = FreeAxis; | ||
1896 | this.LockedAngularAxisLow.Y = -angularMax; | ||
1897 | this.LockedAngularAxisHigh.Y = angularMax; | ||
1898 | break; | ||
1899 | case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z: | ||
1900 | this.LockedAngularAxis.Z = FreeAxis; | ||
1901 | this.LockedAngularAxisLow.Z = -angularMax; | ||
1902 | this.LockedAngularAxisHigh.Z = angularMax; | ||
1903 | break; | ||
1904 | case ExtendedPhysics.PHYS_AXIS_UNLOCK: | ||
1905 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR, 0f, 0f); | ||
1906 | ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f); | ||
1907 | break; | ||
1908 | default: | ||
1909 | break; | ||
1910 | } | ||
1911 | return; | ||
1912 | } | ||
1610 | #endregion // Extension | 1913 | #endregion // Extension |
1611 | 1914 | ||
1612 | // The physics engine says that properties have updated. Update same and inform | 1915 | // The physics engine says that properties have updated. Update same and inform |