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/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs81
2 files changed, 37 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5f33452..54e8d50 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2181,7 +2181,7 @@ namespace OpenSim.Region.Framework.Scenes
2181 } 2181 }
2182 } 2182 }
2183 2183
2184 public void setAngularImpulse(Vector3 impulse) 2184 public void ApplyAngularImpulse(Vector3 impulse)
2185 { 2185 {
2186 PhysicsActor pa = RootPart.PhysActor; 2186 PhysicsActor pa = RootPart.PhysActor;
2187 2187
@@ -2189,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes
2189 { 2189 {
2190 if (!IsAttachment) 2190 if (!IsAttachment)
2191 { 2191 {
2192 pa.Torque = impulse; 2192 pa.AddAngularForce(impulse, true);
2193 m_scene.PhysicsScene.AddPhysicsActorTaint(pa); 2193 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2194 } 2194 }
2195 } 2195 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index aed25a7..951e987 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1789,7 +1789,7 @@ namespace OpenSim.Region.Framework.Scenes
1789 impulse = newimpulse; 1789 impulse = newimpulse;
1790 } 1790 }
1791 1791
1792 ParentGroup.setAngularImpulse(impulse); 1792 ParentGroup.ApplyAngularImpulse(impulse);
1793 } 1793 }
1794 1794
1795 /// <summary> 1795 /// <summary>
@@ -2153,26 +2153,26 @@ namespace OpenSim.Region.Framework.Scenes
2153 if (ParentGroup.RootPart == this) 2153 if (ParentGroup.RootPart == this)
2154 AngularVelocity = new Vector3(0, 0, 0); 2154 AngularVelocity = new Vector3(0, 0, 0);
2155 2155
2156 if (PhysActor.Phantom) 2156 if (pa.Phantom)
2157 { 2157 {
2158 RemoveFromPhysics(); 2158 RemoveFromPhysics();
2159 return; 2159 return;
2160 } 2160 }
2161 2161
2162 PhysActor.IsPhysical = UsePhysics; 2162 pa.IsPhysical = UsePhysics;
2163 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 2163 pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
2164 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 2164 pa.OnOutOfBounds -= PhysicsOutOfBounds;
2165 PhysActor.delink(); 2165 pa.delink();
2166 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 2166 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
2167 { 2167 {
2168 // destroy all joints connected to this now deactivated body 2168 // destroy all joints connected to this now deactivated body
2169 ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); 2169 ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
2170 } 2170 }
2171 } 2171 }
2172 } 2172 }
2173 2173
2174 if (PhysActor.IsPhysical != UsePhysics) 2174 if (pa.IsPhysical != UsePhysics)
2175 PhysActor.IsPhysical = UsePhysics; 2175 pa.IsPhysical = UsePhysics;
2176 2176
2177 if (UsePhysics) 2177 if (UsePhysics)
2178 { 2178 {
@@ -2186,26 +2186,19 @@ namespace OpenSim.Region.Framework.Scenes
2186 2186
2187 if (ParentID != 0 && ParentID != LocalId) 2187 if (ParentID != 0 && ParentID != LocalId)
2188 { 2188 {
2189 ParentGroup.Scene.AddPhysicalPrim(1); 2189 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
2190 2190
2191 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 2191 if (parentPa != null)
2192 pa.OnOutOfBounds += PhysicsOutOfBounds;
2193 if (ParentID != 0 && ParentID != LocalId)
2194 { 2192 {
2195 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; 2193 pa.link(parentPa);
2196
2197 if (parentPa != null)
2198 {
2199 pa.link(parentPa);
2200 }
2201 } 2194 }
2202 } 2195 }
2203 } 2196 }
2204 } 2197 }
2205 2198
2206 bool phan = ((Flags & PrimFlags.Phantom) != 0); 2199 bool phan = ((Flags & PrimFlags.Phantom) != 0);
2207 if (PhysActor.Phantom != phan) 2200 if (pa.Phantom != phan)
2208 PhysActor.Phantom = phan; 2201 pa.Phantom = phan;
2209 2202
2210 2203
2211 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the 2204 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
@@ -2327,7 +2320,10 @@ namespace OpenSim.Region.Framework.Scenes
2327 PhysicsActor pa = PhysActor; 2320 PhysicsActor pa = PhysActor;
2328 2321
2329 if (pa != null) 2322 if (pa != null)
2330 return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); 2323 {
2324 Vector3 vtmp = pa.CenterOfMass;
2325 return vtmp;
2326 }
2331 else 2327 else
2332 return new Vector3(0, 0, 0); 2328 return new Vector3(0, 0, 0);
2333 } 2329 }
@@ -3531,18 +3527,12 @@ namespace OpenSim.Region.Framework.Scenes
3531 PhysicsActor pa = PhysActor; 3527 PhysicsActor pa = PhysActor;
3532 3528
3533 if (pa != null) 3529 if (pa != null)
3534 pa.FloatOnWater = floatYN == 1; 3530 pa.FloatOnWater = (floatYN == 1);
3535 } 3531 }
3536 3532
3537 public void SetForce(Vector3 force) 3533 public void SetForce(Vector3 force)
3538 { 3534 {
3539 Force = force; 3535 Force = force;
3540/*
3541 if (PhysActor != null)
3542 {
3543 PhysActor.Force = force;
3544 }
3545 */
3546 } 3536 }
3547 3537
3548 public SOPVehicle sopVehicle 3538 public SOPVehicle sopVehicle
@@ -5073,33 +5063,32 @@ namespace OpenSim.Region.Framework.Scenes
5073 } 5063 }
5074 5064
5075 PhysicsActor pa = PhysActor; 5065 PhysicsActor pa = PhysActor;
5076 5066 if (pa != null)
5077 if (
5078 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
5079 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
5080 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
5081 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
5082 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
5083 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
5084 (CollisionSound != UUID.Zero)
5085 )
5086 { 5067 {
5087 // subscribe to physics updates. 5068 const scriptEvents NeededSubsEvents = (
5088 if (pa != null) 5069 scriptEvents.collision | scriptEvents.collision_start| scriptEvents.collision_end |
5070 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
5071 );
5072 if (
5073// ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
5074// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
5075// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
5076// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
5077// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
5078// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
5079 ((AggregateScriptEvents & NeededSubsEvents) != 0) || (CollisionSound != UUID.Zero)
5080 )
5089 { 5081 {
5082 // subscribe to physics updates.
5090 pa.OnCollisionUpdate += PhysicsCollision; 5083 pa.OnCollisionUpdate += PhysicsCollision;
5091 pa.SubscribeEvents(1000); 5084 pa.SubscribeEvents(1000);
5092 } 5085 }
5093 } 5086 else
5094 else
5095 {
5096 if (pa != null)
5097 { 5087 {
5098 pa.UnSubscribeEvents(); 5088 pa.UnSubscribeEvents();
5099 pa.OnCollisionUpdate -= PhysicsCollision; 5089 pa.OnCollisionUpdate -= PhysicsCollision;
5100 } 5090 }
5101 } 5091 }
5102
5103 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 5092 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
5104 //{ 5093 //{
5105 // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 5094 // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;