diff options
author | Melanie | 2013-05-08 20:59:44 +0100 |
---|---|---|
committer | Melanie | 2013-05-08 20:59:44 +0100 |
commit | bda45650674eba7d69bbc262ebc28f2c5c184623 (patch) | |
tree | 43fae3ed56116a8d6c941f011fa8f358c1295442 /OpenSim/Region/Physics | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Delete "" entry for AvatarPicker cap. (diff) | |
download | opensim-SC-bda45650674eba7d69bbc262ebc28f2c5c184623.zip opensim-SC-bda45650674eba7d69bbc262ebc28f2c5c184623.tar.gz opensim-SC-bda45650674eba7d69bbc262ebc28f2c5c184623.tar.bz2 opensim-SC-bda45650674eba7d69bbc262ebc28f2c5c184623.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 16 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 14 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 45 |
3 files changed, 54 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 04ea289..c16b7d3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1028,6 +1028,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1028 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); | 1028 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); |
1029 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); | 1029 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); |
1030 | 1030 | ||
1031 | // Friction reduces vehicle motion | ||
1032 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep); | ||
1033 | linearMotorCorrectionV -= (currentVelV * frictionFactorW); | ||
1034 | |||
1031 | // Motor is vehicle coordinates. Rotate it to world coordinates | 1035 | // Motor is vehicle coordinates. Rotate it to world coordinates |
1032 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; | 1036 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; |
1033 | 1037 | ||
@@ -1041,9 +1045,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1041 | // Add this correction to the velocity to make it faster/slower. | 1045 | // Add this correction to the velocity to make it faster/slower. |
1042 | VehicleVelocity += linearMotorVelocityW; | 1046 | VehicleVelocity += linearMotorVelocityW; |
1043 | 1047 | ||
1044 | // Friction reduces vehicle motion | 1048 | |
1045 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep) * VehicleOrientation; | ||
1046 | VehicleVelocity -= (VehicleVelocity * frictionFactorW); | ||
1047 | 1049 | ||
1048 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", | 1050 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", |
1049 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, | 1051 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, |
@@ -1337,11 +1339,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1337 | // angularMotorContributionV.Y = 0f; | 1339 | // angularMotorContributionV.Y = 0f; |
1338 | // } | 1340 | // } |
1339 | 1341 | ||
1342 | // Reduce any velocity by friction. | ||
1343 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); | ||
1344 | angularMotorContributionV -= (currentAngularV * frictionFactorW); | ||
1345 | |||
1340 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; | 1346 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; |
1341 | 1347 | ||
1342 | // Reduce any velocity by friction. | 1348 | |
1343 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep) * VehicleOrientation; | ||
1344 | VehicleRotationalVelocity -= (VehicleRotationalVelocity * frictionFactorW); | ||
1345 | 1349 | ||
1346 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); | 1350 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); |
1347 | } | 1351 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1f16cc8..350a5d1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -347,21 +347,21 @@ public sealed class BSLinksetCompound : BSLinkset | |||
347 | // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass | 347 | // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass |
348 | OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass(); | 348 | OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass(); |
349 | 349 | ||
350 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(LinksetRoot.RawOrientation); | 350 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation)); |
351 | 351 | ||
352 | // 'centerDisplacement' is the value to subtract from children to give physical offset position | 352 | // 'centerDisplacement' is the value to subtract from children to give physical offset position |
353 | OMV.Vector3 centerDisplacement = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; | 353 | OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; |
354 | if (UseBulletSimRootOffsetHack || disableCOM) | 354 | if (UseBulletSimRootOffsetHack || disableCOM) |
355 | { | 355 | { |
356 | centerDisplacement = OMV.Vector3.Zero; | 356 | centerDisplacementV = OMV.Vector3.Zero; |
357 | LinksetRoot.ClearDisplacement(); | 357 | LinksetRoot.ClearDisplacement(); |
358 | } | 358 | } |
359 | else | 359 | else |
360 | { | 360 | { |
361 | LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacement); | 361 | LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV); |
362 | } | 362 | } |
363 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", | 363 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", |
364 | LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacement); | 364 | LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacementV); |
365 | 365 | ||
366 | // Add the shapes of all the components of the linkset | 366 | // Add the shapes of all the components of the linkset |
367 | int memberIndex = 1; | 367 | int memberIndex = 1; |
@@ -372,8 +372,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
372 | 372 | ||
373 | // Get a reference to the shape of the child and add that shape to the linkset compound shape | 373 | // Get a reference to the shape of the child and add that shape to the linkset compound shape |
374 | BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); | 374 | BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); |
375 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; | 375 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacementV; |
376 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 376 | OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation; |
377 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); | 377 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); |
378 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", | 378 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", |
379 | LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); | 379 | LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 1008184..f89c52f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -117,11 +117,11 @@ public abstract class BSShape | |||
117 | StringBuilder buff = new StringBuilder(); | 117 | StringBuilder buff = new StringBuilder(); |
118 | if (physShapeInfo == null) | 118 | if (physShapeInfo == null) |
119 | { | 119 | { |
120 | buff.Append(",noPhys"); | 120 | buff.Append("<noPhys"); |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | buff.Append(",phy="); | 124 | buff.Append("<phy="); |
125 | buff.Append(physShapeInfo.ToString()); | 125 | buff.Append(physShapeInfo.ToString()); |
126 | } | 126 | } |
127 | buff.Append(",c="); | 127 | buff.Append(",c="); |
@@ -810,17 +810,25 @@ public class BSShapeCompound : BSShape | |||
810 | } | 810 | } |
811 | else | 811 | else |
812 | { | 812 | { |
813 | if (physicsScene.PE.IsCompound(pShape)) | 813 | BSShapeConvexHull chullDesc; |
814 | if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) | ||
814 | { | 815 | { |
815 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); | 816 | chullDesc.Dereference(physicsScene); |
816 | recursiveCompound.Dereference(physicsScene); | ||
817 | } | 817 | } |
818 | else | 818 | else |
819 | { | 819 | { |
820 | if (physicsScene.PE.IsNativeShape(pShape)) | 820 | if (physicsScene.PE.IsCompound(pShape)) |
821 | { | 821 | { |
822 | BSShapeNative nativeShape = new BSShapeNative(pShape); | 822 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); |
823 | nativeShape.Dereference(physicsScene); | 823 | recursiveCompound.Dereference(physicsScene); |
824 | } | ||
825 | else | ||
826 | { | ||
827 | if (physicsScene.PE.IsNativeShape(pShape)) | ||
828 | { | ||
829 | BSShapeNative nativeShape = new BSShapeNative(pShape); | ||
830 | nativeShape.Dereference(physicsScene); | ||
831 | } | ||
824 | } | 832 | } |
825 | } | 833 | } |
826 | } | 834 | } |
@@ -900,6 +908,27 @@ public class BSShapeConvexHull : BSShape | |||
900 | // TODO: schedule aging and destruction of unused meshes. | 908 | // TODO: schedule aging and destruction of unused meshes. |
901 | } | 909 | } |
902 | } | 910 | } |
911 | // Loop through all the known hulls and return the description based on the physical address. | ||
912 | public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) | ||
913 | { | ||
914 | bool ret = false; | ||
915 | BSShapeConvexHull foundDesc = null; | ||
916 | lock (ConvexHulls) | ||
917 | { | ||
918 | foreach (BSShapeConvexHull sh in ConvexHulls.Values) | ||
919 | { | ||
920 | if (sh.physShapeInfo.ReferenceSame(pShape)) | ||
921 | { | ||
922 | foundDesc = sh; | ||
923 | ret = true; | ||
924 | break; | ||
925 | } | ||
926 | |||
927 | } | ||
928 | } | ||
929 | outHull = foundDesc; | ||
930 | return ret; | ||
931 | } | ||
903 | } | 932 | } |
904 | 933 | ||
905 | // ============================================================================================================ | 934 | // ============================================================================================================ |