aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMelanie2012-04-03 23:52:53 +0100
committerMelanie2012-04-03 23:52:53 +0100
commit63c44719f7a67950325690bc4cc848b75318e29f (patch)
treeeaa0575671680d8dad75813dc8700d098a3df622 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentMerge branch 'master' into careminster (diff)
parentterrain save-tile extensions Signed-off-by: Garmin Kawaguichi <garmin.kawagui... (diff)
downloadopensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.zip
opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.gz
opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.bz2
opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs149
1 files changed, 101 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 11fd721..5b47fc0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -725,16 +725,21 @@ namespace OpenSim.Region.Framework.Scenes
725 { 725 {
726 m_isSelected = value; 726 m_isSelected = value;
727 // Tell physics engine that group is selected 727 // Tell physics engine that group is selected
728 if (m_rootPart.PhysActor != null) 728
729 PhysicsActor pa = m_rootPart.PhysActor;
730 if (pa != null)
729 { 731 {
730 m_rootPart.PhysActor.Selected = value; 732 pa.Selected = value;
733
731 // Pass it on to the children. 734 // Pass it on to the children.
732 SceneObjectPart[] parts = m_parts.GetArray(); 735 SceneObjectPart[] parts = m_parts.GetArray();
733 for (int i = 0; i < parts.Length; i++) 736 for (int i = 0; i < parts.Length; i++)
734 { 737 {
735 SceneObjectPart child = parts[i]; 738 SceneObjectPart child = parts[i];
736 if (child.PhysActor != null) 739
737 child.PhysActor.Selected = value; 740 PhysicsActor childPa = child.PhysActor;
741 if (childPa != null)
742 childPa.Selected = value;
738 } 743 }
739 } 744 }
740 if (RootPart.KeyframeMotion != null) 745 if (RootPart.KeyframeMotion != null)
@@ -2166,29 +2171,58 @@ namespace OpenSim.Region.Framework.Scenes
2166 } 2171 }
2167 else 2172 else
2168 { 2173 {
2169 if (RootPart.PhysActor != null) 2174 PhysicsActor pa = RootPart.PhysActor;
2175
2176 if (pa != null)
2170 { 2177 {
2171 RootPart.PhysActor.AddForce(impulse, true); 2178 pa.AddForce(impulse, true);
2172 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); 2179 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2173 } 2180 }
2174 } 2181 }
2175 } 2182 }
2176 2183
2177 public void applyAngularImpulse(Vector3 impulse) 2184 public void applyAngularImpulse(Vector3 impulse)
2178 { 2185 {
2179 if (RootPart.PhysActor != null) 2186 PhysicsActor pa = RootPart.PhysActor;
2187
2188 if (pa != null)
2180 { 2189 {
2181 if (!IsAttachment) 2190 if (!IsAttachment)
2182 { 2191 {
2183 RootPart.PhysActor.AddAngularForce(impulse, true); 2192 pa.AddAngularForce(impulse, true);
2184 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); 2193 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2194 }
2195 }
2196 }
2197
2198 public void setAngularImpulse(Vector3 impulse)
2199 {
2200 PhysicsActor pa = RootPart.PhysActor;
2201
2202 if (pa != null)
2203 {
2204 if (!IsAttachment)
2205 {
2206 pa.Torque = impulse;
2207 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2185 } 2208 }
2186 } 2209 }
2187 } 2210 }
2188 2211
2189 public Vector3 GetTorque() 2212 public Vector3 GetTorque()
2190 { 2213 {
2191 return RootPart.Torque; 2214 PhysicsActor pa = RootPart.PhysActor;
2215
2216 if (pa != null)
2217 {
2218 if (!IsAttachment)
2219 {
2220 Vector3 torque = pa.Torque;
2221 return torque;
2222 }
2223 }
2224
2225 return Vector3.Zero;
2192 } 2226 }
2193 2227
2194 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object 2228 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object
@@ -2204,19 +2238,23 @@ namespace OpenSim.Region.Framework.Scenes
2204 } 2238 }
2205 else 2239 else
2206 { 2240 {
2207 if (RootPart.PhysActor != null) 2241 PhysicsActor pa = RootPart.PhysActor;
2242
2243 if (pa != null)
2208 { 2244 {
2209 RootPart.PhysActor.PIDTarget = target; 2245 pa.PIDTarget = target;
2210 RootPart.PhysActor.PIDTau = tau; 2246 pa.PIDTau = tau;
2211 RootPart.PhysActor.PIDActive = true; 2247 pa.PIDActive = true;
2212 } 2248 }
2213 } 2249 }
2214 } 2250 }
2215 2251
2216 public void stopMoveToTarget() 2252 public void stopMoveToTarget()
2217 { 2253 {
2218 if (RootPart.PhysActor != null) 2254 PhysicsActor pa = RootPart.PhysActor;
2219 RootPart.PhysActor.PIDActive = false; 2255
2256 if (pa != null)
2257 pa.PIDActive = false;
2220 } 2258 }
2221 2259
2222 public void rotLookAt(Quaternion target, float strength, float damping) 2260 public void rotLookAt(Quaternion target, float strength, float damping)
@@ -2267,18 +2305,20 @@ namespace OpenSim.Region.Framework.Scenes
2267 /// <param name="tau">Number of seconds over which to reach target</param> 2305 /// <param name="tau">Number of seconds over which to reach target</param>
2268 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) 2306 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
2269 { 2307 {
2270 if (RootPart.PhysActor != null) 2308 PhysicsActor pa = RootPart.PhysActor;
2309
2310 if (pa != null)
2271 { 2311 {
2272 if (height != 0f) 2312 if (height != 0f)
2273 { 2313 {
2274 RootPart.PhysActor.PIDHoverHeight = height; 2314 pa.PIDHoverHeight = height;
2275 RootPart.PhysActor.PIDHoverType = hoverType; 2315 pa.PIDHoverType = hoverType;
2276 RootPart.PhysActor.PIDTau = tau; 2316 pa.PIDTau = tau;
2277 RootPart.PhysActor.PIDHoverActive = true; 2317 pa.PIDHoverActive = true;
2278 } 2318 }
2279 else 2319 else
2280 { 2320 {
2281 RootPart.PhysActor.PIDHoverActive = false; 2321 pa.PIDHoverActive = false;
2282 } 2322 }
2283 } 2323 }
2284 } 2324 }
@@ -2771,10 +2811,10 @@ namespace OpenSim.Region.Framework.Scenes
2771 linkPart.ParentID = 0; 2811 linkPart.ParentID = 0;
2772 linkPart.LinkNum = 0; 2812 linkPart.LinkNum = 0;
2773 2813
2774 if (linkPart.PhysActor != null) 2814 PhysicsActor linkPartPa = linkPart.PhysActor;
2775 { 2815
2776 m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); 2816 if (linkPartPa != null)
2777 } 2817 m_scene.PhysicsScene.RemovePrim(linkPartPa);
2778 2818
2779 // We need to reset the child part's position 2819 // We need to reset the child part's position
2780 // ready for life as a separate object after being a part of another object 2820 // ready for life as a separate object after being a part of another object
@@ -2875,17 +2915,19 @@ namespace OpenSim.Region.Framework.Scenes
2875 { 2915 {
2876 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 2916 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
2877 { 2917 {
2878 if (m_rootPart.PhysActor != null) 2918 PhysicsActor pa = m_rootPart.PhysActor;
2919
2920 if (pa != null)
2879 { 2921 {
2880 if (m_rootPart.PhysActor.IsPhysical) 2922 if (pa.IsPhysical)
2881 { 2923 {
2882 if (!m_rootPart.BlockGrab) 2924 if (!m_rootPart.BlockGrab)
2883 { 2925 {
2884 Vector3 llmoveforce = pos - AbsolutePosition; 2926 Vector3 llmoveforce = pos - AbsolutePosition;
2885 Vector3 grabforce = llmoveforce; 2927 Vector3 grabforce = llmoveforce;
2886 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2928 grabforce = (grabforce / 10) * pa.Mass;
2887 m_rootPart.PhysActor.AddForce(grabforce, true); 2929 pa.AddForce(grabforce, true);
2888 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2930 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2889 } 2931 }
2890 } 2932 }
2891 else 2933 else
@@ -2915,9 +2957,11 @@ namespace OpenSim.Region.Framework.Scenes
2915 { 2957 {
2916 if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) 2958 if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
2917 { 2959 {
2918 if (m_rootPart.PhysActor != null) 2960 PhysicsActor pa = m_rootPart.PhysActor;
2961
2962 if (pa != null)
2919 { 2963 {
2920 if (m_rootPart.PhysActor.IsPhysical) 2964 if (pa.IsPhysical)
2921 { 2965 {
2922 m_rootPart.IsWaitingForFirstSpinUpdatePacket = true; 2966 m_rootPart.IsWaitingForFirstSpinUpdatePacket = true;
2923 } 2967 }
@@ -2958,12 +3002,13 @@ namespace OpenSim.Region.Framework.Scenes
2958 // but it will result in over-shoot or under-shoot of the target orientation. 3002 // but it will result in over-shoot or under-shoot of the target orientation.
2959 // For the end user, this means that ctrl+shift+drag can be used for relative, 3003 // For the end user, this means that ctrl+shift+drag can be used for relative,
2960 // but not absolute, adjustments of orientation for physical prims. 3004 // but not absolute, adjustments of orientation for physical prims.
2961
2962 if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) 3005 if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
2963 { 3006 {
2964 if (m_rootPart.PhysActor != null) 3007 PhysicsActor pa = m_rootPart.PhysActor;
3008
3009 if (pa != null)
2965 { 3010 {
2966 if (m_rootPart.PhysActor.IsPhysical) 3011 if (pa.IsPhysical)
2967 { 3012 {
2968 if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) 3013 if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
2969 { 3014 {
@@ -2989,9 +3034,9 @@ namespace OpenSim.Region.Framework.Scenes
2989 3034
2990 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); 3035 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
2991 Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); 3036 Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
2992 spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor 3037 spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
2993 m_rootPart.PhysActor.AddAngularForce(spinforce,true); 3038 pa.AddAngularForce(spinforce,true);
2994 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 3039 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2995 } 3040 }
2996 } 3041 }
2997 else 3042 else
@@ -3199,8 +3244,10 @@ namespace OpenSim.Region.Framework.Scenes
3199 { 3244 {
3200 part.UpdateShape(shapeBlock); 3245 part.UpdateShape(shapeBlock);
3201 3246
3202 if (part.PhysActor != null) 3247 PhysicsActor pa = m_rootPart.PhysActor;
3203 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 3248
3249 if (pa != null)
3250 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
3204 } 3251 }
3205 } 3252 }
3206 3253
@@ -3218,7 +3265,9 @@ namespace OpenSim.Region.Framework.Scenes
3218 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); 3265 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
3219 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); 3266 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
3220 3267
3221 if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) 3268 PhysicsActor pa = m_rootPart.PhysActor;
3269
3270 if (pa != null && pa.IsPhysical)
3222 { 3271 {
3223 scale.X = Math.Min(scale.X, Scene.m_maxPhys); 3272 scale.X = Math.Min(scale.X, Scene.m_maxPhys);
3224 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); 3273 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
@@ -3243,7 +3292,7 @@ namespace OpenSim.Region.Framework.Scenes
3243 float f = 1.0f; 3292 float f = 1.0f;
3244 float a = 1.0f; 3293 float a = 1.0f;
3245 3294
3246 if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) 3295 if (pa != null && pa.IsPhysical)
3247 { 3296 {
3248 if (oldSize.X * x > m_scene.m_maxPhys) 3297 if (oldSize.X * x > m_scene.m_maxPhys)
3249 { 3298 {
@@ -3558,13 +3607,17 @@ namespace OpenSim.Region.Framework.Scenes
3558 // needs to be called with phys building true 3607 // needs to be called with phys building true
3559 Quaternion axRot = rot; 3608 Quaternion axRot = rot;
3560 Quaternion oldParentRot = m_rootPart.RotationOffset; 3609 Quaternion oldParentRot = m_rootPart.RotationOffset;
3561 3610
3611 m_rootPart.StoreUndoState();
3562 //Don't use UpdateRotation because it schedules an update prematurely 3612 //Don't use UpdateRotation because it schedules an update prematurely
3563 m_rootPart.RotationOffset = rot; 3613 m_rootPart.RotationOffset = rot;
3564 if (m_rootPart.PhysActor != null) 3614
3615 PhysicsActor pa = m_rootPart.PhysActor;
3616
3617 if (pa != null)
3565 { 3618 {
3566 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; 3619 pa.Orientation = m_rootPart.RotationOffset;
3567 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 3620 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
3568 } 3621 }
3569 3622
3570 SceneObjectPart[] parts = m_parts.GetArray(); 3623 SceneObjectPart[] parts = m_parts.GetArray();