aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs63
2 files changed, 46 insertions, 63 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e780f86..4fb0afb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2535,46 +2535,6 @@ namespace OpenSim.Region.Framework.Scenes
2535 RootPart.ScheduleTerseUpdate(); // send a stop information 2535 RootPart.ScheduleTerseUpdate(); // send a stop information
2536 } 2536 }
2537 } 2537 }
2538
2539 public void rotLookAt(Quaternion target, float strength, float damping)
2540 {
2541 SceneObjectPart rootpart = m_rootPart;
2542 if (rootpart != null)
2543 {
2544 if (IsAttachment)
2545 {
2546 /*
2547 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2548 if (avatar != null)
2549 {
2550 Rotate the Av?
2551 } */
2552 }
2553 else
2554 {
2555 if (rootpart.PhysActor != null)
2556 { // APID must be implemented in your physics system for this to function.
2557 rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
2558 rootpart.PhysActor.APIDStrength = strength;
2559 rootpart.PhysActor.APIDDamping = damping;
2560 rootpart.PhysActor.APIDActive = true;
2561 }
2562 }
2563 }
2564 }
2565
2566 public void stopLookAt()
2567 {
2568 SceneObjectPart rootpart = m_rootPart;
2569 if (rootpart != null)
2570 {
2571 if (rootpart.PhysActor != null)
2572 { // APID must be implemented in your physics system for this to function.
2573 rootpart.PhysActor.APIDActive = false;
2574 }
2575 }
2576
2577 }
2578 2538
2579 /// <summary> 2539 /// <summary>
2580 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. 2540 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
@@ -2726,12 +2686,14 @@ namespace OpenSim.Region.Framework.Scenes
2726 } 2686 }
2727 } 2687 }
2728 2688
2689 // while physics doesn't suports LookAt, we do it in RootPart
2690 if (!IsSelected)
2691 RootPart.UpdateLookAt();
2692
2729 SceneObjectPart[] parts = m_parts.GetArray(); 2693 SceneObjectPart[] parts = m_parts.GetArray();
2730 for (int i = 0; i < parts.Length; i++) 2694 for (int i = 0; i < parts.Length; i++)
2731 { 2695 {
2732 SceneObjectPart part = parts[i]; 2696 SceneObjectPart part = parts[i];
2733 if (!IsSelected)
2734 part.UpdateLookAt();
2735 part.SendScheduledUpdates(); 2697 part.SendScheduledUpdates();
2736 } 2698 }
2737 } 2699 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 52f9b51..e8d976d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -458,6 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
458 Velocity = Vector3.Zero; 458 Velocity = Vector3.Zero;
459 AngularVelocity = Vector3.Zero; 459 AngularVelocity = Vector3.Zero;
460 Acceleration = Vector3.Zero; 460 Acceleration = Vector3.Zero;
461 APIDActive = false;
461 Flags = 0; 462 Flags = 0;
462 CreateSelected = true; 463 CreateSelected = true;
463 464
@@ -1713,12 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes
1713 { 1714 {
1714 if (PhysActor != null) 1715 if (PhysActor != null)
1715 { 1716 {
1716 Velocity = new Vector3(0, 0, 0);
1717 Acceleration = new Vector3(0, 0, 0);
1718 if (ParentGroup.RootPart == this)
1719 AngularVelocity = new Vector3(0, 0, 0);
1720 ParentGroup.Scene.RemovePhysicalPrim(1); 1717 ParentGroup.Scene.RemovePhysicalPrim(1);
1721 RemoveFromPhysics(); 1718 RemoveFromPhysics();
1719 Stop();
1722 } 1720 }
1723 } 1721 }
1724 else if (PhysActor == null) 1722 else if (PhysActor == null)
@@ -2350,9 +2348,7 @@ namespace OpenSim.Region.Framework.Scenes
2350 ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed? 2348 ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
2351 2349
2352 // make sure client isn't interpolating the joint proxy object 2350 // make sure client isn't interpolating the joint proxy object
2353 Velocity = Vector3.Zero; 2351 Stop();
2354 AngularVelocity = Vector3.Zero;
2355 Acceleration = Vector3.Zero;
2356 } 2352 }
2357 } 2353 }
2358 } 2354 }
@@ -2391,8 +2387,8 @@ namespace OpenSim.Region.Framework.Scenes
2391 2387
2392 Velocity = new Vector3(0, 0, 0); 2388 Velocity = new Vector3(0, 0, 0);
2393 Acceleration = new Vector3(0, 0, 0); 2389 Acceleration = new Vector3(0, 0, 0);
2394 if (ParentGroup.RootPart == this) 2390 AngularVelocity = new Vector3(0, 0, 0);
2395 AngularVelocity = new Vector3(0, 0, 0); 2391 APIDActive = false;
2396 2392
2397 if (pa.Phantom && !VolumeDetectActive) 2393 if (pa.Phantom && !VolumeDetectActive)
2398 { 2394 {
@@ -2994,7 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes
2994 } 2990 }
2995 //ParentGroup.RootPart.m_groupPosition = newpos; 2991 //ParentGroup.RootPart.m_groupPosition = newpos;
2996 } 2992 }
2997/* ubit: there are no flexible links 2993/*
2998 if (pa != null && ParentID != 0 && ParentGroup != null) 2994 if (pa != null && ParentID != 0 && ParentGroup != null)
2999 { 2995 {
3000 // Special case where a child object is requesting property updates. 2996 // Special case where a child object is requesting property updates.
@@ -3095,6 +3091,14 @@ namespace OpenSim.Region.Framework.Scenes
3095 3091
3096 public void RotLookAt(Quaternion target, float strength, float damping) 3092 public void RotLookAt(Quaternion target, float strength, float damping)
3097 { 3093 {
3094 // non physical is done on LSL
3095 // physical is a rootpart thing
3096 if(ParentGroup.IsDeleted)
3097 return;
3098
3099 if(ParentGroup.RootPart != this)
3100 ParentGroup.RootPart.RotLookAt(target, strength, damping);
3101
3098 if (ParentGroup.IsAttachment) 3102 if (ParentGroup.IsAttachment)
3099 { 3103 {
3100 /* 3104 /*
@@ -3125,15 +3129,30 @@ namespace OpenSim.Region.Framework.Scenes
3125 3129
3126 public void StartLookAt(Quaternion target, float strength, float damping) 3130 public void StartLookAt(Quaternion target, float strength, float damping)
3127 { 3131 {
3132 // non physical is done on LSL
3133 // physical is a rootpart thing
3134 if(ParentGroup.IsDeleted)
3135 return;
3136
3137 if(ParentGroup.RootPart != this)
3138 ParentGroup.RootPart.RotLookAt(target, strength, damping);
3139
3128 RotLookAt(target,strength,damping); 3140 RotLookAt(target,strength,damping);
3129 } 3141 }
3130 3142
3131 public void StopLookAt() 3143 public void StopLookAt()
3132 { 3144 {
3133 APIDActive = false; 3145 if(ParentGroup.IsDeleted)
3134 } 3146 return;
3135 3147
3148 if(ParentGroup.RootPart != this)
3149 ParentGroup.RootPart.StopLookAt();
3136 3150
3151 if(APIDActive)
3152 AngularVelocity = Vector3.Zero;
3153
3154 APIDActive = false;
3155 }
3137 3156
3138 public void ScheduleFullUpdateIfNone() 3157 public void ScheduleFullUpdateIfNone()
3139 { 3158 {
@@ -3543,7 +3562,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
3543 } 3562 }
3544 } 3563 }
3545 3564
3546
3547 public int VehicleType 3565 public int VehicleType
3548 { 3566 {
3549 get 3567 get
@@ -4733,10 +4751,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4733 RemoveFromPhysics(); 4751 RemoveFromPhysics();
4734 } 4752 }
4735 4753
4736 Velocity = new Vector3(0, 0, 0); 4754 Stop();
4737 Acceleration = new Vector3(0, 0, 0);
4738 if (ParentGroup.RootPart == this)
4739 AngularVelocity = new Vector3(0, 0, 0);
4740 } 4755 }
4741 4756
4742 else 4757 else
@@ -4909,17 +4924,15 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4909 } 4924 }
4910 } 4925 }
4911 4926
4912 if (applyDynamics) 4927 if (applyDynamics && LocalId != ParentGroup.RootPart.LocalId)
4913 // do independent of isphysical so parameters get setted (at least some) 4928 // do independent of isphysical so parameters get setted (at least some)
4914 { 4929 {
4915 Velocity = velocity; 4930 Velocity = velocity;
4916 AngularVelocity = rotationalVelocity; 4931 AngularVelocity = rotationalVelocity;
4917// pa.Velocity = velocity;
4918 pa.RotationalVelocity = rotationalVelocity; 4932 pa.RotationalVelocity = rotationalVelocity;
4919 4933
4920 // if not vehicle and root part apply force and torque 4934 // if not vehicle and root part apply force and torque
4921 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE) 4935 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE))
4922 && LocalId == ParentGroup.RootPart.LocalId)
4923 { 4936 {
4924 pa.Force = Force; 4937 pa.Force = Force;
4925 pa.Torque = Torque; 4938 pa.Torque = Torque;
@@ -5629,5 +5642,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5629 return m_sittingAvatars.Count; 5642 return m_sittingAvatars.Count;
5630 } 5643 }
5631 } 5644 }
5645
5646 public void Stop()
5647 {
5648 Velocity = Vector3.Zero;
5649 AngularVelocity = Vector3.Zero;
5650 Acceleration = Vector3.Zero;
5651 APIDActive = false;
5652 }
5632 } 5653 }
5633} 5654}