Merge branch 'ubitwork' into avination

avinationmerge
Melanie 2013-01-11 23:52:48 +01:00
commit 6e9092421b
4 changed files with 42 additions and 32 deletions

View File

@ -345,9 +345,9 @@ namespace OpenSim.Region.Framework.Scenes
m_baseRotation = m_group.GroupRotation; m_baseRotation = m_group.GroupRotation;
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); m_group.RootPart.AngularVelocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
m_frames.Clear(); m_frames.Clear();
} }
@ -357,8 +357,10 @@ namespace OpenSim.Region.Framework.Scenes
RemoveTimer(); RemoveTimer();
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); m_group.RootPart.AngularVelocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
} }
private void GetNextList() private void GetNextList()
@ -490,6 +492,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
} }
m_inOnTimer = false; m_inOnTimer = false;
return; return;
@ -539,13 +543,15 @@ namespace OpenSim.Region.Framework.Scenes
if (steps <= 0.0) if (steps <= 0.0)
{ {
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); m_group.RootPart.AngularVelocity = Vector3.Zero;
m_nextPosition = (Vector3)m_currentFrame.Position; m_nextPosition = (Vector3)m_currentFrame.Position;
m_group.AbsolutePosition = m_nextPosition; m_group.AbsolutePosition = m_nextPosition;
m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); // we are sending imediate updates, no doing force a extra terseUpdate
// m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation);
m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
m_frames.RemoveAt(0); m_frames.RemoveAt(0);
if (m_frames.Count > 0) if (m_frames.Count > 0)
m_currentFrame = m_frames[0]; m_currentFrame = m_frames[0];
@ -613,7 +619,9 @@ namespace OpenSim.Region.Framework.Scenes
// assuming w is a dependente var // assuming w is a dependente var
{ {
m_group.UpdateGroupRotationR(step); // m_group.UpdateGroupRotationR(step);
m_group.RootPart.RotationOffset = step;
//m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2);
update = true; update = true;
} }
@ -622,6 +630,8 @@ namespace OpenSim.Region.Framework.Scenes
if (update) if (update)
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
} }
catch ( Exception ex) catch ( Exception ex)
@ -672,6 +682,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
} }
} }
@ -683,6 +694,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
if (m_running && m_timer != null) if (m_running && m_timer != null)
{ {

View File

@ -307,9 +307,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return RootPart.VolumeDetectActive; } get { return RootPart.VolumeDetectActive; }
} }
private Vector3 lastPhysGroupPos;
private Quaternion lastPhysGroupRot;
private bool m_isBackedUp; private bool m_isBackedUp;
public bool IsBackedUp public bool IsBackedUp
@ -2525,6 +2522,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion #endregion
public override void Update() public override void Update()
{ {
// Check that the group was not deleted before the scheduled update // Check that the group was not deleted before the scheduled update
@ -2543,19 +2541,8 @@ namespace OpenSim.Region.Framework.Scenes
// check to see if the physical position or rotation warrant an update. // check to see if the physical position or rotation warrant an update.
if (m_rootPart.UpdateFlag == UpdateRequired.NONE) if (m_rootPart.UpdateFlag == UpdateRequired.NONE)
{ {
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); // rootpart SendScheduledUpdates will check if a update is needed
if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f))
{
m_rootPart.UpdateFlag = UpdateRequired.TERSE; m_rootPart.UpdateFlag = UpdateRequired.TERSE;
lastPhysGroupPos = AbsolutePosition;
}
if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f))
{
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
lastPhysGroupRot = GroupRotation;
}
} }
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();

View File

@ -319,7 +319,7 @@ namespace OpenSim.Region.Framework.Scenes
protected Vector3 m_lastVelocity; protected Vector3 m_lastVelocity;
protected Vector3 m_lastAcceleration; protected Vector3 m_lastAcceleration;
protected Vector3 m_lastAngularVelocity; protected Vector3 m_lastAngularVelocity;
protected int m_lastTerseSent; protected int m_lastUpdateSentTime;
protected float m_buoyancy = 0.0f; protected float m_buoyancy = 0.0f;
protected Vector3 m_force; protected Vector3 m_force;
protected Vector3 m_torque; protected Vector3 m_torque;
@ -3198,6 +3198,14 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null) if (ParentGroup == null)
return; return;
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
m_lastAngularVelocity = AngularVelocity;
m_lastUpdateSentTime = Environment.TickCount;
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{ {
SendFullUpdate(avatar.ControllingClient); SendFullUpdate(avatar.ControllingClient);
@ -3271,17 +3279,10 @@ namespace OpenSim.Region.Framework.Scenes
Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) ||
!AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) ||
!OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE)
{ {
SendTerseUpdateToAllClients(); SendTerseUpdateToAllClients();
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
m_lastAngularVelocity = AngularVelocity;
m_lastTerseSent = Environment.TickCount;
} }
break; break;
} }
@ -3302,6 +3303,14 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.Scene == null) if (ParentGroup == null || ParentGroup.Scene == null)
return; return;
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
m_lastAngularVelocity = AngularVelocity;
m_lastUpdateSentTime = Environment.TickCount;
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
{ {
SendTerseUpdateToClient(client); SendTerseUpdateToClient(client);

View File

@ -12691,7 +12691,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((data & KeyframeMotion.DataFormat.Rotation) != 0) if ((data & KeyframeMotion.DataFormat.Rotation) != 0)
{ {
LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++);
frame.Rotation = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
q.Normalize();
frame.Rotation = q;
} }
float tempf = (float)frames.GetLSLFloatItem(idx++); float tempf = (float)frames.GetLSLFloatItem(idx++);