change spinobject math, and a few minor things

LSLKeyTest
UbitUmarov 2016-09-16 22:10:36 +01:00
parent 1b18711205
commit 2338d3d2e5
3 changed files with 14 additions and 37 deletions

View File

@ -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,

View File

@ -1674,32 +1674,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
/* moved to scene ProcessObjectGrabUpdate
/// <summary>
/// Move the given object
/// </summary>
/// <param name="objectID"></param>
/// <param name="offset"></param>
/// <param name="pos"></param>
/// <param name="remoteClient"></param>
protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> 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();
}
}
*/
/// <summary>
///

View File

@ -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);
}