aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 00951d6..17dfb85 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3607,7 +3607,7 @@ namespace OpenSim.Region.Framework.Scenes
3607 { 3607 {
3608 if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) 3608 if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
3609 { 3609 {
3610 // first time initialization of "old" orientation for calculation of delta rotations 3610 // first time initialization of "old" orientation for calculation of delta rotations
3611 m_rootPart.SpinOldOrientation = newOrientation; 3611 m_rootPart.SpinOldOrientation = newOrientation;
3612 m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; 3612 m_rootPart.IsWaitingForFirstSpinUpdatePacket = false;
3613 } 3613 }
@@ -3620,16 +3620,21 @@ namespace OpenSim.Region.Framework.Scenes
3620 //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); 3620 //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation);
3621 3621
3622 // compute difference between previous old rotation and new incoming rotation 3622 // compute difference between previous old rotation and new incoming rotation
3623 Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation; 3623 Quaternion minimalRotationFromQ1ToQ2 = newOrientation * Quaternion.Inverse(old);
3624 3624
3625 float rotationAngle; 3625 float rotationAngle;
3626 Vector3 rotationAxis; 3626 Vector3 spinforce;
3627 minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle); 3627 minimalRotationFromQ1ToQ2.GetAxisAngle(out spinforce, out rotationAngle);
3628 rotationAxis.Normalize(); 3628 if(Math.Abs(rotationAngle)< 0.001)
3629 return;
3630
3631 spinforce.Normalize();
3629 3632
3630 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); 3633 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
3631 Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); 3634 if(rotationAngle > 0)
3632 spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor 3635 spinforce = spinforce * pa.Mass * 0.1f; // 0.1 is an arbitrary torque scaling factor
3636 else
3637 spinforce = spinforce * pa.Mass * -0.1f; // 0.1 is an arbitrary torque scaling
3633 pa.AddAngularForce(spinforce,true); 3638 pa.AddAngularForce(spinforce,true);
3634 m_scene.PhysicsScene.AddPhysicsActorTaint(pa); 3639 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
3635 } 3640 }