aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-09-16 22:10:36 +0100
committerUbitUmarov2016-09-16 22:10:36 +0100
commit2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15 (patch)
tree2b2409057b5c690881f72241bee7e1144ba8dc7d
parentmove SpinObject funtions from Scenegraph to PacketHandlers, close to grab han... (diff)
downloadopensim-SC-2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15.zip
opensim-SC-2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15.tar.gz
opensim-SC-2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15.tar.bz2
opensim-SC-2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15.tar.xz
change spinobject math, and a few minor things
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs6
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs19
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
456 456
457 public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient) 457 public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient)
458 { 458 {
459/* no op for now
459 SceneObjectGroup group = GetGroupByPrim(objectID); 460 SceneObjectGroup group = GetGroupByPrim(objectID);
460 if (group != null) 461 if (group != null)
461 { 462 {
@@ -463,12 +464,9 @@ namespace OpenSim.Region.Framework.Scenes
463 { 464 {
464// group.SpinMovement(rotation, remoteClient); 465// group.SpinMovement(rotation, remoteClient);
465 } 466 }
466 // This is outside the above permissions condition
467 // so that if the object is locked the client moving the object
468 // get's it's position on the simulator even if it was the same as before
469 // This keeps the moving user's client in sync with the rest of the world.
470 group.SendGroupTerseUpdate(); 467 group.SendGroupTerseUpdate();
471 } 468 }
469*/
472 } 470 }
473 471
474 public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, 472 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
1674 } 1674 }
1675 } 1675 }
1676 } 1676 }
1677/* moved to scene ProcessObjectGrabUpdate
1678 /// <summary>
1679 /// Move the given object
1680 /// </summary>
1681 /// <param name="objectID"></param>
1682 /// <param name="offset"></param>
1683 /// <param name="pos"></param>
1684 /// <param name="remoteClient"></param>
1685 protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
1686 {
1687 SceneObjectGroup group = GetGroupByPrim(objectID);
1688 if (group != null)
1689 {
1690 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
1691 {
1692 group.GrabMovement(objectID, offset, pos, remoteClient);
1693 }
1694
1695 // This is outside the above permissions condition
1696 // so that if the object is locked the client moving the object
1697 // get's it's position on the simulator even if it was the same as before
1698 // This keeps the moving user's client in sync with the rest of the world.
1699 group.SendGroupTerseUpdate();
1700 }
1701 }
1702*/
1703 1677
1704 /// <summary> 1678 /// <summary>
1705 /// 1679 ///
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 }