aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authoropensim2009-09-30 18:51:02 +0200
committeropensim2009-09-30 18:51:02 +0200
commit827b0fb1993c6f9b1289931a1ac38ff2b810952c (patch)
tree3c5e7b7fe5b21fdf159d64f1264a9d41ceac7b69 /OpenSim/Region/Framework
parentFinish the (untested) authentication connector (diff)
downloadopensim-SC_OLD-827b0fb1993c6f9b1289931a1ac38ff2b810952c.zip
opensim-SC_OLD-827b0fb1993c6f9b1289931a1ac38ff2b810952c.tar.gz
opensim-SC_OLD-827b0fb1993c6f9b1289931a1ac38ff2b810952c.tar.bz2
opensim-SC_OLD-827b0fb1993c6f9b1289931a1ac38ff2b810952c.tar.xz
Commit initial version of KittoFlora's vehicle changes
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs267
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs6
6 files changed, 149 insertions, 178 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index eb397f6..a6e137d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2265,7 +2265,7 @@ namespace OpenSim.Region.Framework.Scenes
2265 group.ClearPartAttachmentData(); 2265 group.ClearPartAttachmentData();
2266 } 2266 }
2267 2267
2268 group.UpdateGroupRotation(rot); 2268 group.UpdateGroupRotationR(rot);
2269 2269
2270 //group.ApplyPhysics(m_physicalPrim); 2270 //group.ApplyPhysics(m_physicalPrim);
2271 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) 2271 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d8478a2..db107a9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2810,7 +2810,7 @@ namespace OpenSim.Region.Framework.Scenes
2810 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 2810 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
2811 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 2811 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
2812 //obj.Rotation = worldRot; 2812 //obj.Rotation = worldRot;
2813 //obj.UpdateGroupRotation(worldRot); 2813 //obj.UpdateGroupRotationR(worldRot);
2814 } 2814 }
2815 else 2815 else
2816 { 2816 {
@@ -4504,7 +4504,7 @@ namespace OpenSim.Region.Framework.Scenes
4504 Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; 4504 Quaternion q = trackedBody.RotationOffset * joint.LocalRotation;
4505 4505
4506 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update 4506 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
4507 jointProxyObject.ParentGroup.UpdateGroupRotation(q); // schedules the entire group for a terse update 4507 jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update
4508 } 4508 }
4509 break; 4509 break;
4510 } 4510 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 48dea07..09116fa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1236,7 +1236,7 @@ namespace OpenSim.Region.Framework.Scenes
1236 { 1236 {
1237 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1237 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
1238 { 1238 {
1239 group.UpdateGroupRotation(rot); 1239 group.UpdateGroupRotationR(rot);
1240 } 1240 }
1241 } 1241 }
1242 } 1242 }
@@ -1255,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes
1255 { 1255 {
1256 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1256 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
1257 { 1257 {
1258 group.UpdateGroupRotation(pos, rot); 1258 group.UpdateGroupRotationPR(pos, rot);
1259 } 1259 }
1260 } 1260 }
1261 } 1261 }
@@ -1811,7 +1811,7 @@ namespace OpenSim.Region.Framework.Scenes
1811 1811
1812 if (rot != Quaternion.Identity) 1812 if (rot != Quaternion.Identity)
1813 { 1813 {
1814 copy.UpdateGroupRotation(rot); 1814 copy.UpdateGroupRotationR(rot);
1815 } 1815 }
1816 1816
1817 copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); 1817 copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3c17bbe..4bd10bd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -368,6 +368,13 @@ namespace OpenSim.Region.Framework.Scenes
368 #region Constructors 368 #region Constructors
369 369
370 /// <summary> 370 /// <summary>
371 /// Constructor
372 /// </summary>
373 public SceneObjectGroup()
374 {
375 }
376
377 /// <summary>
371 /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. 378 /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart.
372 /// The original SceneObjectPart will be used rather than a copy, preserving 379 /// The original SceneObjectPart will be used rather than a copy, preserving
373 /// its existing localID and UUID. 380 /// its existing localID and UUID.
@@ -2953,8 +2960,9 @@ namespace OpenSim.Region.Framework.Scenes
2953 /// 2960 ///
2954 /// </summary> 2961 /// </summary>
2955 /// <param name="rot"></param> 2962 /// <param name="rot"></param>
2956 public void UpdateGroupRotation(Quaternion rot) 2963 public void UpdateGroupRotationR(Quaternion rot)
2957 { 2964 {
2965
2958 m_rootPart.UpdateRotation(rot); 2966 m_rootPart.UpdateRotation(rot);
2959 if (m_rootPart.PhysActor != null) 2967 if (m_rootPart.PhysActor != null)
2960 { 2968 {
@@ -2971,7 +2979,7 @@ namespace OpenSim.Region.Framework.Scenes
2971 /// </summary> 2979 /// </summary>
2972 /// <param name="pos"></param> 2980 /// <param name="pos"></param>
2973 /// <param name="rot"></param> 2981 /// <param name="rot"></param>
2974 public void UpdateGroupRotation(Vector3 pos, Quaternion rot) 2982 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
2975 { 2983 {
2976 m_rootPart.UpdateRotation(rot); 2984 m_rootPart.UpdateRotation(rot);
2977 if (m_rootPart.PhysActor != null) 2985 if (m_rootPart.PhysActor != null)
@@ -3079,22 +3087,26 @@ namespace OpenSim.Region.Framework.Scenes
3079 int yaxis = 4; 3087 int yaxis = 4;
3080 int zaxis = 8; 3088 int zaxis = 8;
3081 3089
3082 setX = ((axis & xaxis) != 0) ? true : false; 3090 if (m_rootPart != null)
3083 setY = ((axis & yaxis) != 0) ? true : false; 3091 {
3084 setZ = ((axis & zaxis) != 0) ? true : false; 3092 setX = ((axis & xaxis) != 0) ? true : false;
3093 setY = ((axis & yaxis) != 0) ? true : false;
3094 setZ = ((axis & zaxis) != 0) ? true : false;
3085 3095
3086 float setval = (rotate10 > 0) ? 1f : 0f; 3096 float setval = (rotate10 > 0) ? 1f : 0f;
3087 3097
3088 if (setX) 3098 if (setX)
3089 m_rootPart.RotationAxis.X = setval; 3099 m_rootPart.RotationAxis.X = setval;
3090 if (setY) 3100 if (setY)
3091 m_rootPart.RotationAxis.Y = setval; 3101 m_rootPart.RotationAxis.Y = setval;
3092 if (setZ) 3102 if (setZ)
3093 m_rootPart.RotationAxis.Z = setval; 3103 m_rootPart.RotationAxis.Z = setval;
3104
3105 if (setX || setY || setZ)
3106 {
3107 m_rootPart.SetPhysicsAxisRotation();
3108 }
3094 3109
3095 if (setX || setY || setZ)
3096 {
3097 m_rootPart.SetPhysicsAxisRotation();
3098 } 3110 }
3099 } 3111 }
3100 3112
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 51bb114..40e7471 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -415,10 +415,9 @@ namespace OpenSim.Region.Framework.Scenes
415 set 415 set
416 { 416 {
417 m_name = value; 417 m_name = value;
418 PhysicsActor pa = PhysActor; 418 if (PhysActor != null)
419 if (pa != null)
420 { 419 {
421 pa.SOPName = value; 420 PhysActor.SOPName = value;
422 } 421 }
423 } 422 }
424 } 423 }
@@ -428,11 +427,10 @@ namespace OpenSim.Region.Framework.Scenes
428 get { return (byte) m_material; } 427 get { return (byte) m_material; }
429 set 428 set
430 { 429 {
431 PhysicsActor pa = PhysActor;
432 m_material = (Material)value; 430 m_material = (Material)value;
433 if (pa != null) 431 if (PhysActor != null)
434 { 432 {
435 pa.SetMaterial((int)value); 433 PhysActor.SetMaterial((int)value);
436 } 434 }
437 } 435 }
438 } 436 }
@@ -503,12 +501,11 @@ namespace OpenSim.Region.Framework.Scenes
503 get 501 get
504 { 502 {
505 // If this is a linkset, we don't want the physics engine mucking up our group position here. 503 // If this is a linkset, we don't want the physics engine mucking up our group position here.
506 PhysicsActor pa = PhysActor; 504 if (PhysActor != null && _parentID == 0)
507 if (pa != null && _parentID == 0)
508 { 505 {
509 m_groupPosition.X = pa.Position.X; 506 m_groupPosition.X = PhysActor.Position.X;
510 m_groupPosition.Y = pa.Position.Y; 507 m_groupPosition.Y = PhysActor.Position.Y;
511 m_groupPosition.Z = pa.Position.Z; 508 m_groupPosition.Z = PhysActor.Position.Z;
512 } 509 }
513 510
514 if (IsAttachment) 511 if (IsAttachment)
@@ -528,27 +525,26 @@ namespace OpenSim.Region.Framework.Scenes
528 525
529 m_groupPosition = value; 526 m_groupPosition = value;
530 527
531 PhysicsActor pa = PhysActor; 528 if (PhysActor != null)
532 if (pa != null)
533 { 529 {
534 try 530 try
535 { 531 {
536 // Root prim actually goes at Position 532 // Root prim actually goes at Position
537 if (_parentID == 0) 533 if (_parentID == 0)
538 { 534 {
539 pa.Position = new PhysicsVector(value.X, value.Y, value.Z); 535 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
540 } 536 }
541 else 537 else
542 { 538 {
543 // To move the child prim in respect to the group position and rotation we have to calculate 539 // To move the child prim in respect to the group position and rotation we have to calculate
544 Vector3 resultingposition = GetWorldPosition(); 540 Vector3 resultingposition = GetWorldPosition();
545 pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); 541 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
546 Quaternion resultingrot = GetWorldRotation(); 542 Quaternion resultingrot = GetWorldRotation();
547 pa.Orientation = resultingrot; 543 PhysActor.Orientation = resultingrot;
548 } 544 }
549 545
550 // Tell the physics engines that this prim changed. 546 // Tell the physics engines that this prim changed.
551 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 547 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
552 } 548 }
553 catch (Exception e) 549 catch (Exception e)
554 { 550 {
@@ -581,16 +577,15 @@ namespace OpenSim.Region.Framework.Scenes
581 577
582 if (ParentGroup != null && !ParentGroup.IsDeleted) 578 if (ParentGroup != null && !ParentGroup.IsDeleted)
583 { 579 {
584 PhysicsActor pa = PhysActor; 580 if (_parentID != 0 && PhysActor != null)
585 if (_parentID != 0 && pa != null)
586 { 581 {
587 Vector3 resultingposition = GetWorldPosition(); 582 Vector3 resultingposition = GetWorldPosition();
588 pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); 583 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
589 Quaternion resultingrot = GetWorldRotation(); 584 Quaternion resultingrot = GetWorldRotation();
590 pa.Orientation = resultingrot; 585 PhysActor.Orientation = resultingrot;
591 586
592 // Tell the physics engines that this prim changed. 587 // Tell the physics engines that this prim changed.
593 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 588 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
594 } 589 }
595 } 590 }
596 } 591 }
@@ -600,14 +595,13 @@ namespace OpenSim.Region.Framework.Scenes
600 { 595 {
601 get 596 get
602 { 597 {
603 PhysicsActor pa = PhysActor;
604 // We don't want the physics engine mucking up the rotations in a linkset 598 // We don't want the physics engine mucking up the rotations in a linkset
605 if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (pa != null)) 599 if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null))
606 { 600 {
607 if (pa.Orientation.X != 0 || pa.Orientation.Y != 0 601 if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0
608 || pa.Orientation.Z != 0 || pa.Orientation.W != 0) 602 || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0)
609 { 603 {
610 m_rotationOffset = pa.Orientation; 604 m_rotationOffset = PhysActor.Orientation;
611 } 605 }
612 } 606 }
613 607
@@ -616,28 +610,27 @@ namespace OpenSim.Region.Framework.Scenes
616 610
617 set 611 set
618 { 612 {
619 PhysicsActor pa = PhysActor;
620 StoreUndoState(); 613 StoreUndoState();
621 m_rotationOffset = value; 614 m_rotationOffset = value;
622 615
623 if (pa != null) 616 if (PhysActor != null)
624 { 617 {
625 try 618 try
626 { 619 {
627 // Root prim gets value directly 620 // Root prim gets value directly
628 if (_parentID == 0) 621 if (_parentID == 0)
629 { 622 {
630 pa.Orientation = value; 623 PhysActor.Orientation = value;
631 //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); 624 //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString());
632 } 625 }
633 else 626 else
634 { 627 {
635 // Child prim we have to calculate it's world rotationwel 628 // Child prim we have to calculate it's world rotationwel
636 Quaternion resultingrotation = GetWorldRotation(); 629 Quaternion resultingrotation = GetWorldRotation();
637 pa.Orientation = resultingrotation; 630 PhysActor.Orientation = resultingrotation;
638 //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); 631 //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString());
639 } 632 }
640 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 633 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
641 //} 634 //}
642 } 635 }
643 catch (Exception ex) 636 catch (Exception ex)
@@ -657,14 +650,13 @@ namespace OpenSim.Region.Framework.Scenes
657 //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 650 //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0
658 //|| PhysActor.Velocity.Z != 0) 651 //|| PhysActor.Velocity.Z != 0)
659 //{ 652 //{
660 PhysicsActor pa = PhysActor; 653 if (PhysActor != null)
661 if (pa != null)
662 { 654 {
663 if (pa.IsPhysical) 655 if (PhysActor.IsPhysical)
664 { 656 {
665 m_velocity.X = pa.Velocity.X; 657 m_velocity.X = PhysActor.Velocity.X;
666 m_velocity.Y = pa.Velocity.Y; 658 m_velocity.Y = PhysActor.Velocity.Y;
667 m_velocity.Z = pa.Velocity.Z; 659 m_velocity.Z = PhysActor.Velocity.Z;
668 } 660 }
669 } 661 }
670 662
@@ -674,13 +666,12 @@ namespace OpenSim.Region.Framework.Scenes
674 set 666 set
675 { 667 {
676 m_velocity = value; 668 m_velocity = value;
677 PhysicsActor pa = PhysActor; 669 if (PhysActor != null)
678 if (pa != null)
679 { 670 {
680 if (pa.IsPhysical) 671 if (PhysActor.IsPhysical)
681 { 672 {
682 pa.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 673 PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
683 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 674 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
684 } 675 }
685 } 676 }
686 } 677 }
@@ -697,10 +688,9 @@ namespace OpenSim.Region.Framework.Scenes
697 { 688 {
698 get 689 get
699 { 690 {
700 PhysicsActor pa = PhysActor; 691 if ((PhysActor != null) && PhysActor.IsPhysical)
701 if ((pa != null) && pa.IsPhysical)
702 { 692 {
703 m_angularVelocity.FromBytes(pa.RotationalVelocity.GetBytes(), 0); 693 m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0);
704 } 694 }
705 return m_angularVelocity; 695 return m_angularVelocity;
706 } 696 }
@@ -719,11 +709,10 @@ namespace OpenSim.Region.Framework.Scenes
719 get { return m_description; } 709 get { return m_description; }
720 set 710 set
721 { 711 {
722 PhysicsActor pa = PhysActor;
723 m_description = value; 712 m_description = value;
724 if (pa != null) 713 if (PhysActor != null)
725 { 714 {
726 pa.SOPDescription = value; 715 PhysActor.SOPDescription = value;
727 } 716 }
728 } 717 }
729 } 718 }
@@ -817,15 +806,14 @@ namespace OpenSim.Region.Framework.Scenes
817if (m_shape != null) { 806if (m_shape != null) {
818 m_shape.Scale = value; 807 m_shape.Scale = value;
819 808
820 PhysicsActor pa = PhysActor; 809 if (PhysActor != null && m_parentGroup != null)
821 if (pa != null && m_parentGroup != null)
822 { 810 {
823 if (m_parentGroup.Scene != null) 811 if (m_parentGroup.Scene != null)
824 { 812 {
825 if (m_parentGroup.Scene.PhysicsScene != null) 813 if (m_parentGroup.Scene.PhysicsScene != null)
826 { 814 {
827 pa.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); 815 PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z);
828 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 816 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
829 } 817 }
830 } 818 }
831 } 819 }
@@ -1355,14 +1343,13 @@ if (m_shape != null) {
1355 RigidBody); 1343 RigidBody);
1356 1344
1357 // Basic Physics returns null.. joy joy joy. 1345 // Basic Physics returns null.. joy joy joy.
1358 PhysicsActor pa = PhysActor; 1346 if (PhysActor != null)
1359 if (pa != null)
1360 { 1347 {
1361 pa.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info 1348 PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
1362 pa.SOPDescription = this.Description; 1349 PhysActor.SOPDescription = this.Description;
1363 pa.LocalID = LocalId; 1350 PhysActor.LocalID = LocalId;
1364 DoPhysicsPropertyUpdate(RigidBody, true); 1351 DoPhysicsPropertyUpdate(RigidBody, true);
1365 pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1352 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1366 } 1353 }
1367 } 1354 }
1368 } 1355 }
@@ -1576,24 +1563,23 @@ if (m_shape != null) {
1576 } 1563 }
1577 else 1564 else
1578 { 1565 {
1579 PhysicsActor pa = PhysActor; 1566 if (PhysActor != null)
1580 if (pa != null)
1581 { 1567 {
1582 if (UsePhysics != pa.IsPhysical || isNew) 1568 if (UsePhysics != PhysActor.IsPhysical || isNew)
1583 { 1569 {
1584 if (pa.IsPhysical) // implies UsePhysics==false for this block 1570 if (PhysActor.IsPhysical) // implies UsePhysics==false for this block
1585 { 1571 {
1586 if (!isNew) 1572 if (!isNew)
1587 ParentGroup.Scene.RemovePhysicalPrim(1); 1573 ParentGroup.Scene.RemovePhysicalPrim(1);
1588 1574
1589 pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1575 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1590 pa.OnOutOfBounds -= PhysicsOutOfBounds; 1576 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
1591 pa.delink(); 1577 PhysActor.delink();
1592 1578
1593 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) 1579 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew))
1594 { 1580 {
1595 // destroy all joints connected to this now deactivated body 1581 // destroy all joints connected to this now deactivated body
1596 m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa); 1582 m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor);
1597 } 1583 }
1598 1584
1599 // stop client-side interpolation of all joint proxy objects that have just been deleted 1585 // stop client-side interpolation of all joint proxy objects that have just been deleted
@@ -1612,7 +1598,7 @@ if (m_shape != null) {
1612 //RotationalVelocity = new Vector3(0, 0, 0); 1598 //RotationalVelocity = new Vector3(0, 0, 0);
1613 } 1599 }
1614 1600
1615 pa.IsPhysical = UsePhysics; 1601 PhysActor.IsPhysical = UsePhysics;
1616 1602
1617 1603
1618 // If we're not what we're supposed to be in the physics scene, recreate ourselves. 1604 // If we're not what we're supposed to be in the physics scene, recreate ourselves.
@@ -1626,19 +1612,19 @@ if (m_shape != null) {
1626 { 1612 {
1627 ParentGroup.Scene.AddPhysicalPrim(1); 1613 ParentGroup.Scene.AddPhysicalPrim(1);
1628 1614
1629 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1615 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1630 pa.OnOutOfBounds += PhysicsOutOfBounds; 1616 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
1631 if (_parentID != 0 && _parentID != LocalId) 1617 if (_parentID != 0 && _parentID != LocalId)
1632 { 1618 {
1633 if (ParentGroup.RootPart.PhysActor != null) 1619 if (ParentGroup.RootPart.PhysActor != null)
1634 { 1620 {
1635 pa.link(ParentGroup.RootPart.PhysActor); 1621 PhysActor.link(ParentGroup.RootPart.PhysActor);
1636 } 1622 }
1637 } 1623 }
1638 } 1624 }
1639 } 1625 }
1640 } 1626 }
1641 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 1627 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1642 } 1628 }
1643 } 1629 }
1644 } 1630 }
@@ -1704,10 +1690,9 @@ if (m_shape != null) {
1704 1690
1705 public Vector3 GetGeometricCenter() 1691 public Vector3 GetGeometricCenter()
1706 { 1692 {
1707 PhysicsActor pa = PhysActor; 1693 if (PhysActor != null)
1708 if (pa != null)
1709 { 1694 {
1710 return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); 1695 return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
1711 } 1696 }
1712 else 1697 else
1713 { 1698 {
@@ -1717,10 +1702,9 @@ if (m_shape != null) {
1717 1702
1718 public float GetMass() 1703 public float GetMass()
1719 { 1704 {
1720 PhysicsActor pa = PhysActor; 1705 if (PhysActor != null)
1721 if (pa != null)
1722 { 1706 {
1723 return pa.Mass; 1707 return PhysActor.Mass;
1724 } 1708 }
1725 else 1709 else
1726 { 1710 {
@@ -1730,9 +1714,8 @@ if (m_shape != null) {
1730 1714
1731 public PhysicsVector GetForce() 1715 public PhysicsVector GetForce()
1732 { 1716 {
1733 PhysicsActor pa = PhysActor; 1717 if (PhysActor != null)
1734 if (pa != null) 1718 return PhysActor.Force;
1735 return pa.Force;
1736 else 1719 else
1737 return new PhysicsVector(); 1720 return new PhysicsVector();
1738 } 1721 }
@@ -2111,15 +2094,11 @@ if (m_shape != null) {
2111 2094
2112 public void PhysicsRequestingTerseUpdate() 2095 public void PhysicsRequestingTerseUpdate()
2113 { 2096 {
2114 PhysicsActor pa = PhysActor; 2097 if (PhysActor != null)
2115 if (pa != null)
2116 { 2098 {
2117 Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); 2099 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
2118 2100
2119 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | 2101 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
2120 m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) |
2121 m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) |
2122 m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
2123 { 2102 {
2124 m_parentGroup.AbsolutePosition = newpos; 2103 m_parentGroup.AbsolutePosition = newpos;
2125 return; 2104 return;
@@ -2315,15 +2294,14 @@ if (m_shape != null) {
2315 if (texture != null) 2294 if (texture != null)
2316 m_shape.SculptData = texture.Data; 2295 m_shape.SculptData = texture.Data;
2317 2296
2318 PhysicsActor pa = PhysActor; 2297 if (PhysActor != null)
2319 if (pa != null)
2320 { 2298 {
2321 // Tricks physics engine into thinking we've changed the part shape. 2299 // Tricks physics engine into thinking we've changed the part shape.
2322 PrimitiveBaseShape m_newshape = m_shape.Copy(); 2300 PrimitiveBaseShape m_newshape = m_shape.Copy();
2323 pa.Shape = m_newshape; 2301 PhysActor.Shape = m_newshape;
2324 m_shape = m_newshape; 2302 m_shape = m_newshape;
2325 2303
2326 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 2304 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2327 } 2305 }
2328 } 2306 }
2329 } 2307 }
@@ -2542,10 +2520,9 @@ if (m_shape != null) {
2542 2520
2543 public void SetBuoyancy(float fvalue) 2521 public void SetBuoyancy(float fvalue)
2544 { 2522 {
2545 PhysicsActor pa = PhysActor; 2523 if (PhysActor != null)
2546 if (pa != null)
2547 { 2524 {
2548 pa.Buoyancy = fvalue; 2525 PhysActor.Buoyancy = fvalue;
2549 } 2526 }
2550 } 2527 }
2551 2528
@@ -2561,62 +2538,56 @@ if (m_shape != null) {
2561 2538
2562 public void SetFloatOnWater(int floatYN) 2539 public void SetFloatOnWater(int floatYN)
2563 { 2540 {
2564 PhysicsActor pa = PhysActor; 2541 if (PhysActor != null)
2565 if (pa != null)
2566 { 2542 {
2567 if (floatYN == 1) 2543 if (floatYN == 1)
2568 { 2544 {
2569 pa.FloatOnWater = true; 2545 PhysActor.FloatOnWater = true;
2570 } 2546 }
2571 else 2547 else
2572 { 2548 {
2573 pa.FloatOnWater = false; 2549 PhysActor.FloatOnWater = false;
2574 } 2550 }
2575 } 2551 }
2576 } 2552 }
2577 2553
2578 public void SetForce(PhysicsVector force) 2554 public void SetForce(PhysicsVector force)
2579 { 2555 {
2580 PhysicsActor pa = PhysActor; 2556 if (PhysActor != null)
2581 if (pa != null)
2582 { 2557 {
2583 pa.Force = force; 2558 PhysActor.Force = force;
2584 } 2559 }
2585 } 2560 }
2586 2561
2587 public void SetVehicleType(int type) 2562 public void SetVehicleType(int type)
2588 { 2563 {
2589 PhysicsActor pa = PhysActor; 2564 if (PhysActor != null)
2590 if (pa != null)
2591 { 2565 {
2592 pa.VehicleType = type; 2566 PhysActor.VehicleType = type;
2593 } 2567 }
2594 } 2568 }
2595 2569
2596 public void SetVehicleFloatParam(int param, float value) 2570 public void SetVehicleFloatParam(int param, float value)
2597 { 2571 {
2598 PhysicsActor pa = PhysActor; 2572 if (PhysActor != null)
2599 if (pa != null)
2600 { 2573 {
2601 pa.VehicleFloatParam(param, value); 2574 PhysActor.VehicleFloatParam(param, value);
2602 } 2575 }
2603 } 2576 }
2604 2577
2605 public void SetVehicleVectorParam(int param, PhysicsVector value) 2578 public void SetVehicleVectorParam(int param, PhysicsVector value)
2606 { 2579 {
2607 PhysicsActor pa = PhysActor; 2580 if (PhysActor != null)
2608 if (pa != null)
2609 { 2581 {
2610 pa.VehicleVectorParam(param, value); 2582 PhysActor.VehicleVectorParam(param, value);
2611 } 2583 }
2612 } 2584 }
2613 2585
2614 public void SetVehicleRotationParam(int param, Quaternion rotation) 2586 public void SetVehicleRotationParam(int param, Quaternion rotation)
2615 { 2587 {
2616 PhysicsActor pa = PhysActor; 2588 if (PhysActor != null)
2617 if (pa != null)
2618 { 2589 {
2619 pa.VehicleRotationParam(param, rotation); 2590 PhysActor.VehicleRotationParam(param, rotation);
2620 } 2591 }
2621 } 2592 }
2622 2593
@@ -2644,11 +2615,10 @@ if (m_shape != null) {
2644 2615
2645 public void SetPhysicsAxisRotation() 2616 public void SetPhysicsAxisRotation()
2646 { 2617 {
2647 PhysicsActor pa = PhysActor; 2618 if (PhysActor != null)
2648 if (pa != null)
2649 { 2619 {
2650 pa.LockAngularMotion(RotationAxis); 2620 PhysActor.LockAngularMotion(RotationAxis);
2651 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 2621 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2652 } 2622 }
2653 } 2623 }
2654 2624
@@ -3380,9 +3350,8 @@ if (m_shape != null) {
3380 { 3350 {
3381 IsVD = false; // Switch it of for the course of this routine 3351 IsVD = false; // Switch it of for the course of this routine
3382 VolumeDetectActive = false; // and also permanently 3352 VolumeDetectActive = false; // and also permanently
3383 PhysicsActor pa = PhysActor; 3353 if (PhysActor != null)
3384 if (pa != null) 3354 PhysActor.SetVolumeDetect(0); // Let physics know about it too
3385 pa.SetVolumeDetect(0); // Let physics know about it too
3386 } 3355 }
3387 else 3356 else
3388 { 3357 {
@@ -3430,21 +3399,18 @@ if (m_shape != null) {
3430 if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints 3399 if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints
3431 { 3400 {
3432 AddFlag(PrimFlags.Phantom); 3401 AddFlag(PrimFlags.Phantom);
3433 PhysicsActor pa = PhysActor; 3402 if (PhysActor != null)
3434 if (pa != null)
3435 { 3403 {
3436 m_parentGroup.Scene.PhysicsScene.RemovePrim(pa); 3404 m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
3437 /// that's not wholesome. Had to make Scene public 3405 /// that's not wholesome. Had to make Scene public
3438 pa = null; 3406 PhysActor = null;
3439 } 3407 }
3440 } 3408 }
3441 else // Not phantom 3409 else // Not phantom
3442 { 3410 {
3443 RemFlag(PrimFlags.Phantom); 3411 RemFlag(PrimFlags.Phantom);
3444 3412
3445 // This is NOT safe!! 3413 if (PhysActor == null)
3446 PhysicsActor pa = PhysActor;
3447 if (pa == null)
3448 { 3414 {
3449 // It's not phantom anymore. So make sure the physics engine get's knowledge of it 3415 // It's not phantom anymore. So make sure the physics engine get's knowledge of it
3450 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 3416 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
@@ -3455,9 +3421,9 @@ if (m_shape != null) {
3455 RotationOffset, 3421 RotationOffset,
3456 UsePhysics); 3422 UsePhysics);
3457 3423
3458 if (pa != null) 3424 if (PhysActor != null)
3459 { 3425 {
3460 pa.LocalID = LocalId; 3426 PhysActor.LocalID = LocalId;
3461 DoPhysicsPropertyUpdate(UsePhysics, true); 3427 DoPhysicsPropertyUpdate(UsePhysics, true);
3462 if (m_parentGroup != null) 3428 if (m_parentGroup != null)
3463 { 3429 {
@@ -3476,14 +3442,14 @@ if (m_shape != null) {
3476 (CollisionSound != UUID.Zero) 3442 (CollisionSound != UUID.Zero)
3477 ) 3443 )
3478 { 3444 {
3479 pa.OnCollisionUpdate += PhysicsCollision; 3445 PhysActor.OnCollisionUpdate += PhysicsCollision;
3480 pa.SubscribeEvents(1000); 3446 PhysActor.SubscribeEvents(1000);
3481 } 3447 }
3482 } 3448 }
3483 } 3449 }
3484 else // it already has a physical representation 3450 else // it already has a physical representation
3485 { 3451 {
3486 pa.IsPhysical = UsePhysics; 3452 PhysActor.IsPhysical = UsePhysics;
3487 3453
3488 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim 3454 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
3489 if (m_parentGroup != null) 3455 if (m_parentGroup != null)
@@ -3506,10 +3472,9 @@ if (m_shape != null) {
3506 // Defensive programming calls for a check here. 3472 // Defensive programming calls for a check here.
3507 // Better would be throwing an exception that could be catched by a unit test as the internal 3473 // Better would be throwing an exception that could be catched by a unit test as the internal
3508 // logic should make sure, this Physactor is always here. 3474 // logic should make sure, this Physactor is always here.
3509 PhysicsActor pa = this.PhysActor; 3475 if (this.PhysActor != null)
3510 if (pa != null)
3511 { 3476 {
3512 pa.SetVolumeDetect(1); 3477 PhysActor.SetVolumeDetect(1);
3513 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active 3478 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
3514 this.VolumeDetectActive = true; 3479 this.VolumeDetectActive = true;
3515 } 3480 }
@@ -3517,11 +3482,10 @@ if (m_shape != null) {
3517 } 3482 }
3518 else 3483 else
3519 { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like 3484 { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
3520 // (mumbles, well, at least if you have infinte CPU powers :-) ) 3485 // (mumbles, well, at least if you have infinte CPU powers :-))
3521 PhysicsActor pa = this.PhysActor; 3486 if (this.PhysActor != null)
3522 if (pa != null)
3523 { 3487 {
3524 pa.SetVolumeDetect(0); 3488 PhysActor.SetVolumeDetect(0);
3525 } 3489 }
3526 this.VolumeDetectActive = false; 3490 this.VolumeDetectActive = false;
3527 } 3491 }
@@ -3579,11 +3543,10 @@ if (m_shape != null) {
3579 m_shape.PathTaperY = shapeBlock.PathTaperY; 3543 m_shape.PathTaperY = shapeBlock.PathTaperY;
3580 m_shape.PathTwist = shapeBlock.PathTwist; 3544 m_shape.PathTwist = shapeBlock.PathTwist;
3581 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; 3545 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
3582 PhysicsActor pa = PhysActor; 3546 if (PhysActor != null)
3583 if (pa != null)
3584 { 3547 {
3585 pa.Shape = m_shape; 3548 PhysActor.Shape = m_shape;
3586 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 3549 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
3587 } 3550 }
3588 3551
3589 // This is what makes vehicle trailers work 3552 // This is what makes vehicle trailers work
@@ -3684,21 +3647,19 @@ if (m_shape != null) {
3684 ) 3647 )
3685 { 3648 {
3686 // subscribe to physics updates. 3649 // subscribe to physics updates.
3687 PhysicsActor pa = PhysActor; 3650 if (PhysActor != null)
3688 if (pa != null)
3689 { 3651 {
3690 pa.OnCollisionUpdate += PhysicsCollision; 3652 PhysActor.OnCollisionUpdate += PhysicsCollision;
3691 pa.SubscribeEvents(1000); 3653 PhysActor.SubscribeEvents(1000);
3692 3654
3693 } 3655 }
3694 } 3656 }
3695 else 3657 else
3696 { 3658 {
3697 PhysicsActor pa = PhysActor; 3659 if (PhysActor != null)
3698 if (pa != null)
3699 { 3660 {
3700 pa.UnSubscribeEvents(); 3661 PhysActor.UnSubscribeEvents();
3701 pa.OnCollisionUpdate -= PhysicsCollision; 3662 PhysActor.OnCollisionUpdate -= PhysicsCollision;
3702 } 3663 }
3703 } 3664 }
3704 3665
@@ -3801,8 +3762,6 @@ if (m_shape != null) {
3801 lPos = AbsolutePosition; 3762 lPos = AbsolutePosition;
3802 } 3763 }
3803 3764
3804 // Causes this thread to dig into the Client Thread Data.
3805 // Remember your locking here!
3806 remoteClient.SendPrimTerseUpdate(m_regionHandle, 3765 remoteClient.SendPrimTerseUpdate(m_regionHandle,
3807 (ushort)(m_parentGroup.GetTimeDilation() * 3766 (ushort)(m_parentGroup.GetTimeDilation() *
3808 (float)ushort.MaxValue), LocalId, lPos, 3767 (float)ushort.MaxValue), LocalId, lPos,
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index bf13607..e74b18e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
70 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); 70 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
71 71
72 // <180,0,0> 72 // <180,0,0>
73 grp2.UpdateGroupRotation(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); 73 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
74 74
75 // Required for linking 75 // Required for linking
76 grp1.RootPart.UpdateFlag = 0; 76 grp1.RootPart.UpdateFlag = 0;
@@ -154,13 +154,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
154 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); 154 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
155 155
156 // <180,0,0> 156 // <180,0,0>
157 grp2.UpdateGroupRotation(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); 157 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
158 158
159 // <270,0,0> 159 // <270,0,0>
160 grp3.Rotation = (Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0)); 160 grp3.Rotation = (Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0));
161 161
162 // <0,90,0> 162 // <0,90,0>
163 grp4.UpdateGroupRotation(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0)); 163 grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0));
164 164
165 // Required for linking 165 // Required for linking
166 grp1.RootPart.UpdateFlag = 0; 166 grp1.RootPart.UpdateFlag = 0;