diff options
author | Melanie | 2013-01-11 23:52:48 +0100 |
---|---|---|
committer | Melanie | 2013-01-11 23:52:48 +0100 |
commit | 6e9092421b2f047dca26fc560d12a629f1177319 (patch) | |
tree | 80b847237c67810798d1b8c852b61f543ee290b2 | |
parent | Change IsRoot to use ReferenceEquals to prevent operator == messiness (diff) | |
parent | make sure keyframe rotations are normalized (diff) | |
download | opensim-SC_OLD-6e9092421b2f047dca26fc560d12a629f1177319.zip opensim-SC_OLD-6e9092421b2f047dca26fc560d12a629f1177319.tar.gz opensim-SC_OLD-6e9092421b2f047dca26fc560d12a629f1177319.tar.bz2 opensim-SC_OLD-6e9092421b2f047dca26fc560d12a629f1177319.tar.xz |
Merge branch 'ubitwork' into avination
4 files changed, 42 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index edf2bef..5cfba39 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -345,9 +345,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | m_baseRotation = m_group.GroupRotation; | 345 | m_baseRotation = m_group.GroupRotation; |
346 | 346 | ||
347 | m_group.RootPart.Velocity = Vector3.Zero; | 347 | m_group.RootPart.Velocity = Vector3.Zero; |
348 | m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); | 348 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
349 | m_group.SendGroupRootTerseUpdate(); | 349 | m_group.SendGroupRootTerseUpdate(); |
350 | 350 | // m_group.RootPart.ScheduleTerseUpdate(); | |
351 | m_frames.Clear(); | 351 | m_frames.Clear(); |
352 | } | 352 | } |
353 | 353 | ||
@@ -357,8 +357,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
357 | RemoveTimer(); | 357 | RemoveTimer(); |
358 | 358 | ||
359 | m_group.RootPart.Velocity = Vector3.Zero; | 359 | m_group.RootPart.Velocity = Vector3.Zero; |
360 | m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); | 360 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
361 | m_group.SendGroupRootTerseUpdate(); | 361 | m_group.SendGroupRootTerseUpdate(); |
362 | // m_group.RootPart.ScheduleTerseUpdate(); | ||
363 | |||
362 | } | 364 | } |
363 | 365 | ||
364 | private void GetNextList() | 366 | private void GetNextList() |
@@ -490,6 +492,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
490 | { | 492 | { |
491 | m_group.RootPart.Velocity = Vector3.Zero; | 493 | m_group.RootPart.Velocity = Vector3.Zero; |
492 | m_group.SendGroupRootTerseUpdate(); | 494 | m_group.SendGroupRootTerseUpdate(); |
495 | // m_group.RootPart.ScheduleTerseUpdate(); | ||
496 | |||
493 | } | 497 | } |
494 | m_inOnTimer = false; | 498 | m_inOnTimer = false; |
495 | return; | 499 | return; |
@@ -539,13 +543,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
539 | if (steps <= 0.0) | 543 | if (steps <= 0.0) |
540 | { | 544 | { |
541 | m_group.RootPart.Velocity = Vector3.Zero; | 545 | m_group.RootPart.Velocity = Vector3.Zero; |
542 | m_group.RootPart.UpdateAngularVelocity(Vector3.Zero); | 546 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
543 | 547 | ||
544 | m_nextPosition = (Vector3)m_currentFrame.Position; | 548 | m_nextPosition = (Vector3)m_currentFrame.Position; |
545 | m_group.AbsolutePosition = m_nextPosition; | 549 | m_group.AbsolutePosition = m_nextPosition; |
546 | 550 | ||
547 | m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); | 551 | // we are sending imediate updates, no doing force a extra terseUpdate |
552 | // m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); | ||
548 | 553 | ||
554 | m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation; | ||
549 | m_frames.RemoveAt(0); | 555 | m_frames.RemoveAt(0); |
550 | if (m_frames.Count > 0) | 556 | if (m_frames.Count > 0) |
551 | m_currentFrame = m_frames[0]; | 557 | m_currentFrame = m_frames[0]; |
@@ -613,7 +619,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
613 | // assuming w is a dependente var | 619 | // assuming w is a dependente var |
614 | 620 | ||
615 | { | 621 | { |
616 | m_group.UpdateGroupRotationR(step); | 622 | // m_group.UpdateGroupRotationR(step); |
623 | m_group.RootPart.RotationOffset = step; | ||
624 | |||
617 | //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); | 625 | //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); |
618 | update = true; | 626 | update = true; |
619 | } | 627 | } |
@@ -622,6 +630,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
622 | 630 | ||
623 | if (update) | 631 | if (update) |
624 | m_group.SendGroupRootTerseUpdate(); | 632 | m_group.SendGroupRootTerseUpdate(); |
633 | // m_group.RootPart.ScheduleTerseUpdate(); | ||
634 | |||
625 | 635 | ||
626 | } | 636 | } |
627 | catch ( Exception ex) | 637 | catch ( Exception ex) |
@@ -672,6 +682,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
672 | { | 682 | { |
673 | m_group.RootPart.Velocity = Vector3.Zero; | 683 | m_group.RootPart.Velocity = Vector3.Zero; |
674 | m_group.SendGroupRootTerseUpdate(); | 684 | m_group.SendGroupRootTerseUpdate(); |
685 | // m_group.RootPart.ScheduleTerseUpdate(); | ||
675 | } | 686 | } |
676 | } | 687 | } |
677 | 688 | ||
@@ -683,6 +694,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
683 | { | 694 | { |
684 | m_group.RootPart.Velocity = Vector3.Zero; | 695 | m_group.RootPart.Velocity = Vector3.Zero; |
685 | m_group.SendGroupRootTerseUpdate(); | 696 | m_group.SendGroupRootTerseUpdate(); |
697 | // m_group.RootPart.ScheduleTerseUpdate(); | ||
686 | 698 | ||
687 | if (m_running && m_timer != null) | 699 | if (m_running && m_timer != null) |
688 | { | 700 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4ad8b11..b008e66 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -307,9 +307,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
307 | get { return RootPart.VolumeDetectActive; } | 307 | get { return RootPart.VolumeDetectActive; } |
308 | } | 308 | } |
309 | 309 | ||
310 | private Vector3 lastPhysGroupPos; | ||
311 | private Quaternion lastPhysGroupRot; | ||
312 | |||
313 | private bool m_isBackedUp; | 310 | private bool m_isBackedUp; |
314 | 311 | ||
315 | public bool IsBackedUp | 312 | public bool IsBackedUp |
@@ -2525,6 +2522,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2525 | 2522 | ||
2526 | #endregion | 2523 | #endregion |
2527 | 2524 | ||
2525 | |||
2528 | public override void Update() | 2526 | public override void Update() |
2529 | { | 2527 | { |
2530 | // Check that the group was not deleted before the scheduled update | 2528 | // Check that the group was not deleted before the scheduled update |
@@ -2543,19 +2541,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2543 | // check to see if the physical position or rotation warrant an update. | 2541 | // check to see if the physical position or rotation warrant an update. |
2544 | if (m_rootPart.UpdateFlag == UpdateRequired.NONE) | 2542 | if (m_rootPart.UpdateFlag == UpdateRequired.NONE) |
2545 | { | 2543 | { |
2546 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 2544 | // rootpart SendScheduledUpdates will check if a update is needed |
2547 | 2545 | m_rootPart.UpdateFlag = UpdateRequired.TERSE; | |
2548 | if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) | ||
2549 | { | ||
2550 | m_rootPart.UpdateFlag = UpdateRequired.TERSE; | ||
2551 | lastPhysGroupPos = AbsolutePosition; | ||
2552 | } | ||
2553 | |||
2554 | if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) | ||
2555 | { | ||
2556 | m_rootPart.UpdateFlag = UpdateRequired.TERSE; | ||
2557 | lastPhysGroupRot = GroupRotation; | ||
2558 | } | ||
2559 | } | 2546 | } |
2560 | 2547 | ||
2561 | SceneObjectPart[] parts = m_parts.GetArray(); | 2548 | SceneObjectPart[] parts = m_parts.GetArray(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b62667f..ff4ae85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -319,7 +319,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
319 | protected Vector3 m_lastVelocity; | 319 | protected Vector3 m_lastVelocity; |
320 | protected Vector3 m_lastAcceleration; | 320 | protected Vector3 m_lastAcceleration; |
321 | protected Vector3 m_lastAngularVelocity; | 321 | protected Vector3 m_lastAngularVelocity; |
322 | protected int m_lastTerseSent; | 322 | protected int m_lastUpdateSentTime; |
323 | protected float m_buoyancy = 0.0f; | 323 | protected float m_buoyancy = 0.0f; |
324 | protected Vector3 m_force; | 324 | protected Vector3 m_force; |
325 | protected Vector3 m_torque; | 325 | protected Vector3 m_torque; |
@@ -3198,6 +3198,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3198 | if (ParentGroup == null) | 3198 | if (ParentGroup == null) |
3199 | return; | 3199 | return; |
3200 | 3200 | ||
3201 | // Update the "last" values | ||
3202 | m_lastPosition = OffsetPosition; | ||
3203 | m_lastRotation = RotationOffset; | ||
3204 | m_lastVelocity = Velocity; | ||
3205 | m_lastAcceleration = Acceleration; | ||
3206 | m_lastAngularVelocity = AngularVelocity; | ||
3207 | m_lastUpdateSentTime = Environment.TickCount; | ||
3208 | |||
3201 | ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 3209 | ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
3202 | { | 3210 | { |
3203 | SendFullUpdate(avatar.ControllingClient); | 3211 | SendFullUpdate(avatar.ControllingClient); |
@@ -3271,17 +3279,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3271 | Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || | 3279 | Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || |
3272 | !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || | 3280 | !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || |
3273 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 3281 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
3274 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3282 | Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) |
3275 | { | 3283 | { |
3276 | SendTerseUpdateToAllClients(); | 3284 | SendTerseUpdateToAllClients(); |
3277 | 3285 | ||
3278 | // Update the "last" values | ||
3279 | m_lastPosition = OffsetPosition; | ||
3280 | m_lastRotation = RotationOffset; | ||
3281 | m_lastVelocity = Velocity; | ||
3282 | m_lastAcceleration = Acceleration; | ||
3283 | m_lastAngularVelocity = AngularVelocity; | ||
3284 | m_lastTerseSent = Environment.TickCount; | ||
3285 | } | 3286 | } |
3286 | break; | 3287 | break; |
3287 | } | 3288 | } |
@@ -3302,6 +3303,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3302 | if (ParentGroup == null || ParentGroup.Scene == null) | 3303 | if (ParentGroup == null || ParentGroup.Scene == null) |
3303 | return; | 3304 | return; |
3304 | 3305 | ||
3306 | // Update the "last" values | ||
3307 | m_lastPosition = OffsetPosition; | ||
3308 | m_lastRotation = RotationOffset; | ||
3309 | m_lastVelocity = Velocity; | ||
3310 | m_lastAcceleration = Acceleration; | ||
3311 | m_lastAngularVelocity = AngularVelocity; | ||
3312 | m_lastUpdateSentTime = Environment.TickCount; | ||
3313 | |||
3305 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) | 3314 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) |
3306 | { | 3315 | { |
3307 | SendTerseUpdateToClient(client); | 3316 | SendTerseUpdateToClient(client); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0dfcfd6..1e1e574 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -12691,7 +12691,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12691 | if ((data & KeyframeMotion.DataFormat.Rotation) != 0) | 12691 | if ((data & KeyframeMotion.DataFormat.Rotation) != 0) |
12692 | { | 12692 | { |
12693 | LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); | 12693 | LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); |
12694 | frame.Rotation = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); | 12694 | Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); |
12695 | q.Normalize(); | ||
12696 | frame.Rotation = q; | ||
12695 | } | 12697 | } |
12696 | 12698 | ||
12697 | float tempf = (float)frames.GetLSLFloatItem(idx++); | 12699 | float tempf = (float)frames.GetLSLFloatItem(idx++); |