From 2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 16 Sep 2016 22:10:36 +0100
Subject: change spinobject math, and a few minor things
---
.../Framework/Scenes/Scene.PacketHandlers.cs | 6 ++---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 26 ----------------------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 19 ++++++++++------
3 files changed, 14 insertions(+), 37 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index b041986..a5abe76 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -456,6 +456,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient)
{
+/* no op for now
SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null)
{
@@ -463,12 +464,9 @@ namespace OpenSim.Region.Framework.Scenes
{
// group.SpinMovement(rotation, remoteClient);
}
- // This is outside the above permissions condition
- // so that if the object is locked the client moving the object
- // get's it's position on the simulator even if it was the same as before
- // This keeps the moving user's client in sync with the rest of the world.
group.SendGroupTerseUpdate();
}
+*/
}
public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID,
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 4947083..77c66b6 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1674,32 +1674,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
-/* moved to scene ProcessObjectGrabUpdate
- ///
- /// Move the given object
- ///
- ///
- ///
- ///
- ///
- protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs)
- {
- SceneObjectGroup group = GetGroupByPrim(objectID);
- if (group != null)
- {
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
- {
- group.GrabMovement(objectID, offset, pos, remoteClient);
- }
-
- // This is outside the above permissions condition
- // so that if the object is locked the client moving the object
- // get's it's position on the simulator even if it was the same as before
- // This keeps the moving user's client in sync with the rest of the world.
- group.SendGroupTerseUpdate();
- }
- }
-*/
///
///
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
{
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
{
- // first time initialization of "old" orientation for calculation of delta rotations
+ // first time initialization of "old" orientation for calculation of delta rotations
m_rootPart.SpinOldOrientation = newOrientation;
m_rootPart.IsWaitingForFirstSpinUpdatePacket = false;
}
@@ -3620,16 +3620,21 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation);
// compute difference between previous old rotation and new incoming rotation
- Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation;
+ Quaternion minimalRotationFromQ1ToQ2 = newOrientation * Quaternion.Inverse(old);
float rotationAngle;
- Vector3 rotationAxis;
- minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle);
- rotationAxis.Normalize();
+ Vector3 spinforce;
+ minimalRotationFromQ1ToQ2.GetAxisAngle(out spinforce, out rotationAngle);
+ if(Math.Abs(rotationAngle)< 0.001)
+ return;
+
+ spinforce.Normalize();
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
- Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
- spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
+ if(rotationAngle > 0)
+ spinforce = spinforce * pa.Mass * 0.1f; // 0.1 is an arbitrary torque scaling factor
+ else
+ spinforce = spinforce * pa.Mass * -0.1f; // 0.1 is an arbitrary torque scaling
pa.AddAngularForce(spinforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
--
cgit v1.1