aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs84
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
4 files changed, 84 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 4c12496..3390aba 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -592,12 +592,12 @@ namespace OpenSim.Region.Framework.Scenes
592 592
593 protected internal void AddPhysicalPrim(int number) 593 protected internal void AddPhysicalPrim(int number)
594 { 594 {
595 m_physicalPrim++; 595 m_physicalPrim += number;
596 } 596 }
597 597
598 protected internal void RemovePhysicalPrim(int number) 598 protected internal void RemovePhysicalPrim(int number)
599 { 599 {
600 m_physicalPrim--; 600 m_physicalPrim -= number;
601 } 601 }
602 602
603 protected internal void AddToScriptLPS(int number) 603 protected internal void AddToScriptLPS(int number)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3db6710..f68a5b3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -656,6 +656,14 @@ namespace OpenSim.Region.Framework.Scenes
656 if (triggerScriptEvent) 656 if (triggerScriptEvent)
657 part.TriggerScriptChangedEvent(Changed.POSITION); 657 part.TriggerScriptChangedEvent(Changed.POSITION);
658 } 658 }
659
660/*
661 This seems not needed and should not be needed:
662 sp absolute position depends on sit part absolute position fixed above.
663 sp ParentPosition is not used anywhere.
664 Since presence is sitting, viewer considers it 'linked' to root prim, so it will move/rotate it
665 Sending a extra packet with avatar position is not only bandwidth waste, but may cause jitter in viewers due to UPD nature.
666
659 if (!m_dupeInProgress) 667 if (!m_dupeInProgress)
660 { 668 {
661 foreach (ScenePresence av in m_linkedAvatars) 669 foreach (ScenePresence av in m_linkedAvatars)
@@ -665,12 +673,12 @@ namespace OpenSim.Region.Framework.Scenes
665 { 673 {
666 Vector3 offset = p.GetWorldPosition() - av.ParentPosition; 674 Vector3 offset = p.GetWorldPosition() - av.ParentPosition;
667 av.AbsolutePosition += offset; 675 av.AbsolutePosition += offset;
668 av.ParentPosition = p.GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition 676// av.ParentPosition = p.GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
669 av.SendAvatarDataToAllAgents(); 677 av.SendAvatarDataToAllAgents();
670 } 678 }
671 } 679 }
672 } 680 }
673 681*/
674 //if (m_rootPart.PhysActor != null) 682 //if (m_rootPart.PhysActor != null)
675 //{ 683 //{
676 //m_rootPart.PhysActor.Position = 684 //m_rootPart.PhysActor.Position =
@@ -701,8 +709,8 @@ namespace OpenSim.Region.Framework.Scenes
701 if (agent.ParentUUID != UUID.Zero) 709 if (agent.ParentUUID != UUID.Zero)
702 { 710 {
703 agent.ParentPart = null; 711 agent.ParentPart = null;
704 agent.ParentPosition = Vector3.Zero; 712// agent.ParentPosition = Vector3.Zero;
705 // agent.ParentUUID = UUID.Zero; 713// agent.ParentUUID = UUID.Zero;
706 } 714 }
707 } 715 }
708 716
@@ -3815,7 +3823,7 @@ namespace OpenSim.Region.Framework.Scenes
3815 else 3823 else
3816 // ugly rotation update of all parts 3824 // ugly rotation update of all parts
3817 { 3825 {
3818 group.AbsolutePosition = AbsolutePosition; 3826 group.ResetChildPrimPhysicsPositions();
3819 } 3827 }
3820 3828
3821 } 3829 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f1e781c..7b1f5d2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1856,6 +1856,34 @@ namespace OpenSim.Region.Framework.Scenes
1856 } 1856 }
1857 } 1857 }
1858 1858
1859// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
1860 public void SetVelocity(Vector3 pVel, bool localGlobalTF)
1861 {
1862 if (ParentGroup == null || ParentGroup.IsDeleted)
1863 return;
1864
1865 if (ParentGroup.IsAttachment)
1866 return; // don't work on attachments (for now ??)
1867
1868 SceneObjectPart root = ParentGroup.RootPart;
1869
1870 if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles
1871 return;
1872
1873 PhysicsActor pa = root.PhysActor;
1874
1875 if (pa == null || !pa.IsPhysical)
1876 return;
1877
1878 if (localGlobalTF)
1879 {
1880 pVel = pVel * GetWorldRotation();
1881 }
1882
1883 ParentGroup.Velocity = pVel;
1884 }
1885
1886
1859 /// <summary> 1887 /// <summary>
1860 /// hook to the physics scene to apply angular impulse 1888 /// hook to the physics scene to apply angular impulse
1861 /// This is sent up to the group, which then finds the root prim 1889 /// This is sent up to the group, which then finds the root prim
@@ -4512,7 +4540,8 @@ namespace OpenSim.Region.Framework.Scenes
4512 { 4540 {
4513 if (pa != null) 4541 if (pa != null)
4514 { 4542 {
4515 ParentGroup.Scene.RemovePhysicalPrim(1); 4543 if(wasUsingPhysics)
4544 ParentGroup.Scene.RemovePhysicalPrim(1);
4516 RemoveFromPhysics(); 4545 RemoveFromPhysics();
4517 } 4546 }
4518 4547
@@ -4529,37 +4558,36 @@ namespace OpenSim.Region.Framework.Scenes
4529 { 4558 {
4530 AddToPhysics(UsePhysics, SetPhantom, building, false); 4559 AddToPhysics(UsePhysics, SetPhantom, building, false);
4531 pa = PhysActor; 4560 pa = PhysActor;
4532 /* 4561/*
4533 if (pa != null) 4562 if (pa != null)
4534 { 4563 {
4535 if ( 4564 if (
4536 // ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4565// ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4537 // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4566// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4538 // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4567// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4539 // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || 4568// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4540 // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || 4569// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4541 // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || 4570// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4542 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || 4571 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4543 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || 4572 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4544 (CollisionSound != UUID.Zero) 4573 (CollisionSound != UUID.Zero)
4545 ) 4574 )
4546 { 4575 {
4547 pa.OnCollisionUpdate += PhysicsCollision; 4576 pa.OnCollisionUpdate += PhysicsCollision;
4548 pa.SubscribeEvents(1000); 4577 pa.SubscribeEvents(1000);
4549 } 4578 }
4550 } 4579 }
4551 */ 4580*/
4552 } 4581 }
4553 else // it already has a physical representation 4582 else // it already has a physical representation
4554 { 4583 {
4555 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. 4584 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
4556 /* moved into DoPhysicsPropertyUpdate 4585/* moved into DoPhysicsPropertyUpdate
4557 if(VolumeDetectActive) 4586 if(VolumeDetectActive)
4558 pa.SetVolumeDetect(1); 4587 pa.SetVolumeDetect(1);
4559 else 4588 else
4560 pa.SetVolumeDetect(0); 4589 pa.SetVolumeDetect(0);
4561 */ 4590*/
4562
4563 4591
4564 if (pa.Building != building) 4592 if (pa.Building != building)
4565 pa.Building = building; 4593 pa.Building = building;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 159a92a..f0ceff6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -439,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes
439 get { return (IClientCore)ControllingClient; } 439 get { return (IClientCore)ControllingClient; }
440 } 440 }
441 441
442 public Vector3 ParentPosition { get; set; } 442// public Vector3 ParentPosition { get; set; }
443 443
444 /// <summary> 444 /// <summary>
445 /// Position of this avatar relative to the region the avatar is in 445 /// Position of this avatar relative to the region the avatar is in
@@ -497,7 +497,7 @@ namespace OpenSim.Region.Framework.Scenes
497 if (ParentID == 0) 497 if (ParentID == 0)
498 { 498 {
499 m_pos = value; 499 m_pos = value;
500 ParentPosition = Vector3.Zero; 500// ParentPosition = Vector3.Zero;
501 } 501 }
502 502
503 //m_log.DebugFormat( 503 //m_log.DebugFormat(
@@ -865,11 +865,12 @@ namespace OpenSim.Region.Framework.Scenes
865 part.ParentGroup.AddAvatar(UUID); 865 part.ParentGroup.AddAvatar(UUID);
866 if (part.SitTargetPosition != Vector3.Zero) 866 if (part.SitTargetPosition != Vector3.Zero)
867 part.SitTargetAvatar = UUID; 867 part.SitTargetAvatar = UUID;
868 ParentPosition = part.GetWorldPosition(); 868// ParentPosition = part.GetWorldPosition();
869 ParentID = part.LocalId; 869 ParentID = part.LocalId;
870 ParentPart = part; 870 ParentPart = part;
871 m_pos = m_prevSitOffset; 871 m_pos = m_prevSitOffset;
872 pos = ParentPosition; 872// pos = ParentPosition;
873 pos = part.GetWorldPosition();
873 } 874 }
874 ParentUUID = UUID.Zero; 875 ParentUUID = UUID.Zero;
875 876
@@ -1944,11 +1945,12 @@ namespace OpenSim.Region.Framework.Scenes
1944 part.SitTargetAvatar = UUID.Zero; 1945 part.SitTargetAvatar = UUID.Zero;
1945 1946
1946 part.ParentGroup.DeleteAvatar(UUID); 1947 part.ParentGroup.DeleteAvatar(UUID);
1947 ParentPosition = part.GetWorldPosition(); 1948// ParentPosition = part.GetWorldPosition();
1948 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1949 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1949 1950
1950 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); 1951// m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1951 ParentPosition = Vector3.Zero; 1952// ParentPosition = Vector3.Zero;
1953 m_pos += part.GetWorldPosition() + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1952 1954
1953 ParentID = 0; 1955 ParentID = 0;
1954 ParentPart = null; 1956 ParentPart = null;
@@ -2399,13 +2401,13 @@ namespace OpenSim.Region.Framework.Scenes
2399 2401
2400// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; 2402// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
2401 Rotation = sitTargetOrient; 2403 Rotation = sitTargetOrient;
2402 ParentPosition = part.AbsolutePosition; 2404// ParentPosition = part.AbsolutePosition;
2403 part.ParentGroup.AddAvatar(UUID); 2405 part.ParentGroup.AddAvatar(UUID);
2404 } 2406 }
2405 else 2407 else
2406 { 2408 {
2407 m_pos -= part.AbsolutePosition; 2409 m_pos -= part.AbsolutePosition;
2408 ParentPosition = part.AbsolutePosition; 2410// ParentPosition = part.AbsolutePosition;
2409 part.ParentGroup.AddAvatar(UUID); 2411 part.ParentGroup.AddAvatar(UUID);
2410 2412
2411// m_log.DebugFormat( 2413// m_log.DebugFormat(
@@ -3587,7 +3589,8 @@ namespace OpenSim.Region.Framework.Scenes
3587 // m_reprioritizationTimer.Dispose(); 3589 // m_reprioritizationTimer.Dispose();
3588 3590
3589 RemoveFromPhysicalScene(); 3591 RemoveFromPhysicalScene();
3590 Animator.Close(); 3592 if(Animator != null)
3593 Animator.Close();
3591 Animator = null; 3594 Animator = null;
3592 } 3595 }
3593 3596