aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-06-28 22:06:02 +0200
committerMelanie2012-06-28 22:06:02 +0200
commit498820a74f6b288c26e2c33981297568c0c12d08 (patch)
treec87b1c20a3e3deeee56c33719ca8abed96499bdf
parentFix llRegionSayTo the right way (diff)
parent reactivate physics raycasts on llCastRay() until it's clear what is its prob... (diff)
downloadopensim-SC_OLD-498820a74f6b288c26e2c33981297568c0c12d08.zip
opensim-SC_OLD-498820a74f6b288c26e2c33981297568c0c12d08.tar.gz
opensim-SC_OLD-498820a74f6b288c26e2c33981297568c0c12d08.tar.bz2
opensim-SC_OLD-498820a74f6b288c26e2c33981297568c0c12d08.tar.xz
Merge branch 'ubitwork' into avination
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs3
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs5
-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.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs119
7 files changed, 141 insertions, 87 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 5a87958..80b6f64 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -6402,6 +6402,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6402 { 6402 {
6403 handlerCompleteMovementToRegion(sender, true); 6403 handlerCompleteMovementToRegion(sender, true);
6404 } 6404 }
6405 else
6406 m_log.Debug("HandleCompleteAgentMovement NULL handler");
6407
6405 handlerCompleteMovementToRegion = null; 6408 handlerCompleteMovementToRegion = null;
6406 6409
6407 return true; 6410 return true;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 75f783b..bd8273d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -710,14 +710,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
710 IClientAPI client; 710 IClientAPI client;
711 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) 711 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
712 { 712 {
713 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 713// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
714 return; 714 return;
715 } 715 }
716 716
717 udpClient = ((LLClientView)client).UDPClient; 717 udpClient = ((LLClientView)client).UDPClient;
718 718
719 if (!udpClient.IsConnected) 719 if (!udpClient.IsConnected)
720 {
721// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName);
720 return; 722 return;
723 }
721 724
722 #endregion Packet to Client Mapping 725 #endregion Packet to Client Mapping
723 726
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index b7466be..a600b86 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -585,12 +585,12 @@ namespace OpenSim.Region.Framework.Scenes
585 585
586 protected internal void AddPhysicalPrim(int number) 586 protected internal void AddPhysicalPrim(int number)
587 { 587 {
588 m_physicalPrim++; 588 m_physicalPrim += number;
589 } 589 }
590 590
591 protected internal void RemovePhysicalPrim(int number) 591 protected internal void RemovePhysicalPrim(int number)
592 { 592 {
593 m_physicalPrim--; 593 m_physicalPrim -= number;
594 } 594 }
595 595
596 protected internal void AddToScriptLPS(int number) 596 protected internal void AddToScriptLPS(int number)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index aab6a49..96eeec4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -631,6 +631,14 @@ namespace OpenSim.Region.Framework.Scenes
631 if (triggerScriptEvent) 631 if (triggerScriptEvent)
632 part.TriggerScriptChangedEvent(Changed.POSITION); 632 part.TriggerScriptChangedEvent(Changed.POSITION);
633 } 633 }
634
635/*
636 This seems not needed and should not be needed:
637 sp absolute position depends on sit part absolute position fixed above.
638 sp ParentPosition is not used anywhere.
639 Since presence is sitting, viewer considers it 'linked' to root prim, so it will move/rotate it
640 Sending a extra packet with avatar position is not only bandwidth waste, but may cause jitter in viewers due to UPD nature.
641
634 if (!m_dupeInProgress) 642 if (!m_dupeInProgress)
635 { 643 {
636 foreach (ScenePresence av in m_linkedAvatars) 644 foreach (ScenePresence av in m_linkedAvatars)
@@ -640,12 +648,12 @@ namespace OpenSim.Region.Framework.Scenes
640 { 648 {
641 Vector3 offset = p.GetWorldPosition() - av.ParentPosition; 649 Vector3 offset = p.GetWorldPosition() - av.ParentPosition;
642 av.AbsolutePosition += offset; 650 av.AbsolutePosition += offset;
643 av.ParentPosition = p.GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition 651// av.ParentPosition = p.GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
644 av.SendAvatarDataToAllAgents(); 652 av.SendAvatarDataToAllAgents();
645 } 653 }
646 } 654 }
647 } 655 }
648 656*/
649 //if (m_rootPart.PhysActor != null) 657 //if (m_rootPart.PhysActor != null)
650 //{ 658 //{
651 //m_rootPart.PhysActor.Position = 659 //m_rootPart.PhysActor.Position =
@@ -676,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
676 if (agent.ParentUUID != UUID.Zero) 684 if (agent.ParentUUID != UUID.Zero)
677 { 685 {
678 agent.ParentPart = null; 686 agent.ParentPart = null;
679 agent.ParentPosition = Vector3.Zero; 687// agent.ParentPosition = Vector3.Zero;
680 // agent.ParentUUID = UUID.Zero; 688// agent.ParentUUID = UUID.Zero;
681 } 689 }
682 } 690 }
683 691
@@ -3752,7 +3760,7 @@ namespace OpenSim.Region.Framework.Scenes
3752 else 3760 else
3753 // ugly rotation update of all parts 3761 // ugly rotation update of all parts
3754 { 3762 {
3755 group.AbsolutePosition = AbsolutePosition; 3763 group.ResetChildPrimPhysicsPositions();
3756 } 3764 }
3757 3765
3758 } 3766 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8e74dc8..a48605d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4496,7 +4496,8 @@ namespace OpenSim.Region.Framework.Scenes
4496 { 4496 {
4497 if (pa != null) 4497 if (pa != null)
4498 { 4498 {
4499 ParentGroup.Scene.RemovePhysicalPrim(1); 4499 if(wasUsingPhysics)
4500 ParentGroup.Scene.RemovePhysicalPrim(1);
4500 RemoveFromPhysics(); 4501 RemoveFromPhysics();
4501 } 4502 }
4502 4503
@@ -4513,38 +4514,37 @@ namespace OpenSim.Region.Framework.Scenes
4513 { 4514 {
4514 AddToPhysics(UsePhysics, SetPhantom, building, false); 4515 AddToPhysics(UsePhysics, SetPhantom, building, false);
4515 pa = PhysActor; 4516 pa = PhysActor;
4516 /* 4517/*
4517 if (pa != null) 4518 if (pa != null)
4518 { 4519 {
4519 if ( 4520 if (
4520 // ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4521// ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4521 // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4522// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4522 // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4523// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4523 // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || 4524// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4524 // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || 4525// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4525 // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || 4526// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4526 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || 4527 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4527 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || 4528 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4528 (CollisionSound != UUID.Zero) 4529 (CollisionSound != UUID.Zero)
4529 ) 4530 )
4530 { 4531 {
4531 pa.OnCollisionUpdate += PhysicsCollision; 4532 pa.OnCollisionUpdate += PhysicsCollision;
4532 pa.SubscribeEvents(1000); 4533 pa.SubscribeEvents(1000);
4533 } 4534 }
4534 } 4535 }
4535 */ 4536*/
4536 } 4537 }
4537 4538
4538 else // it already has a physical representation 4539 else // it already has a physical representation
4539 { 4540 {
4540 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. 4541 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
4541 /* moved into DoPhysicsPropertyUpdate 4542/* moved into DoPhysicsPropertyUpdate
4542 if(VolumeDetectActive) 4543 if(VolumeDetectActive)
4543 pa.SetVolumeDetect(1); 4544 pa.SetVolumeDetect(1);
4544 else 4545 else
4545 pa.SetVolumeDetect(0); 4546 pa.SetVolumeDetect(0);
4546 */ 4547*/
4547
4548 4548
4549 if (pa.Building != building) 4549 if (pa.Building != building)
4550 pa.Building = building; 4550 pa.Building = building;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 87b4d9f..4940063 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes
433 get { return (IClientCore)ControllingClient; } 433 get { return (IClientCore)ControllingClient; }
434 } 434 }
435 435
436 public Vector3 ParentPosition { get; set; } 436// public Vector3 ParentPosition { get; set; }
437 437
438 /// <summary> 438 /// <summary>
439 /// Position of this avatar relative to the region the avatar is in 439 /// Position of this avatar relative to the region the avatar is in
@@ -491,7 +491,7 @@ namespace OpenSim.Region.Framework.Scenes
491 if (ParentID == 0) 491 if (ParentID == 0)
492 { 492 {
493 m_pos = value; 493 m_pos = value;
494 ParentPosition = Vector3.Zero; 494// ParentPosition = Vector3.Zero;
495 } 495 }
496 496
497 //m_log.DebugFormat( 497 //m_log.DebugFormat(
@@ -857,11 +857,12 @@ namespace OpenSim.Region.Framework.Scenes
857 part.ParentGroup.AddAvatar(UUID); 857 part.ParentGroup.AddAvatar(UUID);
858 if (part.SitTargetPosition != Vector3.Zero) 858 if (part.SitTargetPosition != Vector3.Zero)
859 part.SitTargetAvatar = UUID; 859 part.SitTargetAvatar = UUID;
860 ParentPosition = part.GetWorldPosition(); 860// ParentPosition = part.GetWorldPosition();
861 ParentID = part.LocalId; 861 ParentID = part.LocalId;
862 ParentPart = part; 862 ParentPart = part;
863 m_pos = m_prevSitOffset; 863 m_pos = m_prevSitOffset;
864 pos = ParentPosition; 864// pos = ParentPosition;
865 pos = part.GetWorldPosition();
865 } 866 }
866 ParentUUID = UUID.Zero; 867 ParentUUID = UUID.Zero;
867 868
@@ -1933,11 +1934,12 @@ namespace OpenSim.Region.Framework.Scenes
1933 part.SitTargetAvatar = UUID.Zero; 1934 part.SitTargetAvatar = UUID.Zero;
1934 1935
1935 part.ParentGroup.DeleteAvatar(UUID); 1936 part.ParentGroup.DeleteAvatar(UUID);
1936 ParentPosition = part.GetWorldPosition(); 1937// ParentPosition = part.GetWorldPosition();
1937 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1938 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1938 1939
1939 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); 1940// m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1940 ParentPosition = Vector3.Zero; 1941// ParentPosition = Vector3.Zero;
1942 m_pos += part.GetWorldPosition() + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1941 1943
1942 ParentID = 0; 1944 ParentID = 0;
1943 ParentPart = null; 1945 ParentPart = null;
@@ -2388,13 +2390,13 @@ namespace OpenSim.Region.Framework.Scenes
2388 2390
2389// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; 2391// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
2390 Rotation = sitTargetOrient; 2392 Rotation = sitTargetOrient;
2391 ParentPosition = part.AbsolutePosition; 2393// ParentPosition = part.AbsolutePosition;
2392 part.ParentGroup.AddAvatar(UUID); 2394 part.ParentGroup.AddAvatar(UUID);
2393 } 2395 }
2394 else 2396 else
2395 { 2397 {
2396 m_pos -= part.AbsolutePosition; 2398 m_pos -= part.AbsolutePosition;
2397 ParentPosition = part.AbsolutePosition; 2399// ParentPosition = part.AbsolutePosition;
2398 part.ParentGroup.AddAvatar(UUID); 2400 part.ParentGroup.AddAvatar(UUID);
2399 2401
2400// m_log.DebugFormat( 2402// m_log.DebugFormat(
@@ -3568,7 +3570,8 @@ namespace OpenSim.Region.Framework.Scenes
3568 // m_reprioritizationTimer.Dispose(); 3570 // m_reprioritizationTimer.Dispose();
3569 3571
3570 RemoveFromPhysicalScene(); 3572 RemoveFromPhysicalScene();
3571 Animator.Close(); 3573 if(Animator != null)
3574 Animator.Close();
3572 Animator = null; 3575 Animator = null;
3573 } 3576 }
3574 3577
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a0dc6cd..f475b99 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -660,18 +660,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
660 m_host.AddScriptLPS(1); 660 m_host.AddScriptLPS(1);
661 661
662 double x,y,z,s; 662 double x,y,z,s;
663 663 v.x *= 0.5;
664 double c1 = Math.Cos(v.x * 0.5); 664 v.y *= 0.5;
665 double c2 = Math.Cos(v.y * 0.5); 665 v.z *= 0.5;
666 double c3 = Math.Cos(v.z * 0.5); 666 double c1 = Math.Cos(v.x);
667 double s1 = Math.Sin(v.x * 0.5); 667 double c2 = Math.Cos(v.y);
668 double s2 = Math.Sin(v.y * 0.5); 668 double c1c2 = c1 * c2;
669 double s3 = Math.Sin(v.z * 0.5); 669 double s1 = Math.Sin(v.x);
670 670 double s2 = Math.Sin(v.y);
671 x = s1 * c2 * c3 + c1 * s2 * s3; 671 double s1s2 = s1 * s2;
672 y = c1 * s2 * c3 - s1 * c2 * s3; 672 double c1s2 = c1 * s2;
673 z = s1 * s2 * c3 + c1 * c2 * s3; 673 double s1c2 = s1 * c2;
674 s = c1 * c2 * c3 - s1 * s2 * s3; 674 double c3 = Math.Cos(v.z);
675 double s3 = Math.Sin(v.z);
676
677 x = s1c2 * c3 + c1s2 * s3;
678 y = c1s2 * c3 - s1c2 * s3;
679 z = s1s2 * c3 + c1c2 * s3;
680 s = c1c2 * c3 - s1s2 * s3;
675 681
676 return new LSL_Rotation(x, y, z, s); 682 return new LSL_Rotation(x, y, z, s);
677 } 683 }
@@ -1911,11 +1917,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1911 Primitive.TextureEntry tex = part.Shape.Textures; 1917 Primitive.TextureEntry tex = part.Shape.Textures;
1912 Color4 texcolor; 1918 Color4 texcolor;
1913 LSL_Vector rgb = new LSL_Vector(); 1919 LSL_Vector rgb = new LSL_Vector();
1920 int nsides = GetNumberOfSides(part);
1921
1914 if (face == ScriptBaseClass.ALL_SIDES) 1922 if (face == ScriptBaseClass.ALL_SIDES)
1915 { 1923 {
1916 int i; 1924 int i;
1917 1925 for (i = 0; i < nsides; i++)
1918 for (i = 0 ; i < GetNumberOfSides(part); i++)
1919 { 1926 {
1920 texcolor = tex.GetFace((uint)i).RGBA; 1927 texcolor = tex.GetFace((uint)i).RGBA;
1921 rgb.x += texcolor.R; 1928 rgb.x += texcolor.R;
@@ -1923,13 +1930,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1923 rgb.z += texcolor.B; 1930 rgb.z += texcolor.B;
1924 } 1931 }
1925 1932
1926 rgb.x /= (float)GetNumberOfSides(part); 1933 float invnsides = 1.0f / (float)nsides;
1927 rgb.y /= (float)GetNumberOfSides(part); 1934
1928 rgb.z /= (float)GetNumberOfSides(part); 1935 rgb.x *= invnsides;
1936 rgb.y *= invnsides;
1937 rgb.z *= invnsides;
1929 1938
1930 return rgb; 1939 return rgb;
1931 } 1940 }
1932 if (face >= 0 && face < GetNumberOfSides(part)) 1941 if (face >= 0 && face < nsides)
1933 { 1942 {
1934 texcolor = tex.GetFace((uint)face).RGBA; 1943 texcolor = tex.GetFace((uint)face).RGBA;
1935 rgb.x = texcolor.R; 1944 rgb.x = texcolor.R;
@@ -2328,15 +2337,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2328 // (root prim). ParentID may be nonzero in attachments and 2337 // (root prim). ParentID may be nonzero in attachments and
2329 // using it would cause attachments and HUDs to rotate 2338 // using it would cause attachments and HUDs to rotate
2330 // to the wrong positions. 2339 // to the wrong positions.
2340
2331 SetRot(m_host, Rot2Quaternion(rot)); 2341 SetRot(m_host, Rot2Quaternion(rot));
2332 } 2342 }
2333 else 2343 else
2334 { 2344 {
2335 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 2345 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
2336 SceneObjectPart rootPart = m_host.ParentGroup.RootPart; 2346 SceneObjectPart rootPart;
2337 if (rootPart != null) // better safe than sorry 2347 if (m_host.ParentGroup != null) // better safe than sorry
2338 { 2348 {
2339 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); 2349 rootPart = m_host.ParentGroup.RootPart;
2350 if (rootPart != null)
2351 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2340 } 2352 }
2341 } 2353 }
2342 2354
@@ -2346,6 +2358,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2346 public void llSetLocalRot(LSL_Rotation rot) 2358 public void llSetLocalRot(LSL_Rotation rot)
2347 { 2359 {
2348 m_host.AddScriptLPS(1); 2360 m_host.AddScriptLPS(1);
2361
2349 SetRot(m_host, Rot2Quaternion(rot)); 2362 SetRot(m_host, Rot2Quaternion(rot));
2350 ScriptSleep(200); 2363 ScriptSleep(200);
2351 } 2364 }
@@ -2355,25 +2368,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2355 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 2368 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
2356 return; 2369 return;
2357 2370
2358 part.UpdateRotation(rot); 2371 bool isroot = (part == part.ParentGroup.RootPart);
2359 // Update rotation does not move the object in the physics scene if it's a linkset. 2372 bool isphys;
2360 2373
2361//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
2362// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
2363
2364 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
2365 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
2366 // It's perfectly okay when the object is not an active physical body though.
2367 // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against
2368 // but only if the object is not physial and active. This is important for rotating doors.
2369 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
2370 // scene
2371 PhysicsActor pa = part.PhysActor; 2374 PhysicsActor pa = part.PhysActor;
2372 2375
2373 if (pa != null && !pa.IsPhysical && part == part.ParentGroup.RootPart) 2376 // keep using physactor ideia of isphysical
2377 // it should be SOP ideia of that
2378 // not much of a issue with ubitODE
2379 if (pa != null && pa.IsPhysical)
2380 isphys = true;
2381 else
2382 isphys = false;
2383
2384 // SL doesn't let scripts rotate root of physical linksets
2385 if (isroot && isphys)
2386 return;
2387
2388 part.UpdateRotation(rot);
2389
2390 // Update rotation does not move the object in the physics engine if it's a non physical linkset
2391 // so do a nasty update of parts positions if is a root part rotation
2392 if (isroot && pa != null) // with if above implies non physical root part
2374 { 2393 {
2375 part.ParentGroup.ResetChildPrimPhysicsPositions(); 2394 part.ParentGroup.ResetChildPrimPhysicsPositions();
2376 } 2395 }
2396 else // fix sitting avatars. This is only needed bc of how we link avas to child parts, not root part
2397 {
2398 List<ScenePresence> sittingavas = part.ParentGroup.GetLinkedAvatars();
2399 if (sittingavas.Count > 0)
2400 {
2401 foreach (ScenePresence av in sittingavas)
2402 {
2403 if (isroot || part.LocalId == av.ParentID)
2404 av.SendTerseUpdateToAllClients();
2405 }
2406 }
2407 }
2377 } 2408 }
2378 2409
2379 /// <summary> 2410 /// <summary>
@@ -2422,7 +2453,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2422 public LSL_Rotation llGetLocalRot() 2453 public LSL_Rotation llGetLocalRot()
2423 { 2454 {
2424 m_host.AddScriptLPS(1); 2455 m_host.AddScriptLPS(1);
2425 return new LSL_Rotation(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W); 2456 Quaternion rot = m_host.RotationOffset;
2457 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2426 } 2458 }
2427 2459
2428 public void llSetForce(LSL_Vector force, int local) 2460 public void llSetForce(LSL_Vector force, int local)
@@ -7994,7 +8026,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7994 Quaternion srot = sitpart.RotationOffset; 8026 Quaternion srot = sitpart.RotationOffset;
7995 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation 8027 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
7996 av.Rotation = rot; 8028 av.Rotation = rot;
7997 av.SendAvatarDataToAllAgents(); 8029// av.SendAvatarDataToAllAgents();
8030 av.SendTerseUpdateToAllClients();
7998 } 8031 }
7999 break; 8032 break;
8000 8033
@@ -8014,7 +8047,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8014 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation 8047 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
8015 } 8048 }
8016 av.Rotation = rot; 8049 av.Rotation = rot;
8017 av.SendAvatarDataToAllAgents(); 8050// av.SendAvatarDataToAllAgents();
8051 av.SendTerseUpdateToAllClients();
8018 } 8052 }
8019 break; 8053 break;
8020 8054
@@ -8109,7 +8143,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8109 { 8143 {
8110 positionChanged = false; 8144 positionChanged = false;
8111 av.OffsetPosition = finalPos; 8145 av.OffsetPosition = finalPos;
8112 av.SendAvatarDataToAllAgents(); 8146// av.SendAvatarDataToAllAgents();
8147 av.SendTerseUpdateToAllClients();
8113 } 8148 }
8114 8149
8115 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); 8150 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
@@ -8125,7 +8160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8125 if (positionChanged) 8160 if (positionChanged)
8126 { 8161 {
8127 av.OffsetPosition = finalPos; 8162 av.OffsetPosition = finalPos;
8128 av.SendAvatarDataToAllAgents(); 8163// av.SendAvatarDataToAllAgents();
8164 av.SendTerseUpdateToAllClients();
8129 positionChanged = false; 8165 positionChanged = false;
8130 } 8166 }
8131 } 8167 }
@@ -8534,6 +8570,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8534 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8570 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8535 if (remain < 1) 8571 if (remain < 1)
8536 return; 8572 return;
8573
8537 LSL_Rotation lr = rules.GetQuaternionItem(idx++); 8574 LSL_Rotation lr = rules.GetQuaternionItem(idx++);
8538 SetRot(part, Rot2Quaternion(lr)); 8575 SetRot(part, Rot2Quaternion(lr));
8539 break; 8576 break;
@@ -12577,7 +12614,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12577 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); 12614 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
12578 12615
12579 12616
12580 if (false)// World.SuportsRayCastFiltered()) 12617 if (World.SuportsRayCastFiltered())
12581 { 12618 {
12582 if (dist == 0) 12619 if (dist == 0)
12583 return list; 12620 return list;