aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs8
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs10
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs2
5 files changed, 23 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 6d515e9..217d307 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.Manager
36{ 36{
37 public delegate void physicsCrash(); 37 public delegate void physicsCrash();
38 38
39 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance); 39 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
40 40
41 public abstract class PhysicsScene 41 public abstract class PhysicsScene
42 { 42 {
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Physics.Manager
204 public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) 204 public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
205 { 205 {
206 if (retMethod != null) 206 if (retMethod != null)
207 retMethod(false, Vector3.Zero, 0, 999999999999f); 207 retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
208 } 208 }
209 209
210 private class NullPhysicsScene : PhysicsScene 210 private class NullPhysicsScene : PhysicsScene
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 905d3ba..b99baa2 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1243,7 +1243,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1243 { 1243 {
1244 if (m_eventsubscription > m_requestedUpdateFrequency) 1244 if (m_eventsubscription > m_requestedUpdateFrequency)
1245 { 1245 {
1246 base.SendCollisionUpdate(CollisionEventsThisFrame); 1246 if (CollisionEventsThisFrame != null)
1247 {
1248 base.SendCollisionUpdate(CollisionEventsThisFrame);
1249 }
1247 CollisionEventsThisFrame = new CollisionEventUpdate(); 1250 CollisionEventsThisFrame = new CollisionEventUpdate();
1248 m_eventsubscription = 0; 1251 m_eventsubscription = 0;
1249 } 1252 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index b0e9a91..c27c420 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -743,6 +743,8 @@ namespace OpenSim.Region.Physics.OdePlugin
743 break; 743 break;
744 } 744 }
745 } 745 }
746 if (returnMass > _parent_scene.maximumMassObject)
747 returnMass = _parent_scene.maximumMassObject;
746 return returnMass; 748 return returnMass;
747 }// end CalculateMass 749 }// end CalculateMass
748 750
@@ -753,6 +755,7 @@ namespace OpenSim.Region.Physics.OdePlugin
753 if (Body != (IntPtr) 0) 755 if (Body != (IntPtr) 0)
754 { 756 {
755 float newmass = CalculateMass(); 757 float newmass = CalculateMass();
758
756 //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString()); 759 //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString());
757 760
758 d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z); 761 d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z);
@@ -2158,7 +2161,10 @@ Console.WriteLine(" JointCreateFixed");
2158 // Re creates body on size. 2161 // Re creates body on size.
2159 // EnableBody also does setMass() 2162 // EnableBody also does setMass()
2160 enableBody(); 2163 enableBody();
2161 d.BodyEnable(Body); 2164 if (Body != IntPtr.Zero)
2165 {
2166 d.BodyEnable(Body);
2167 }
2162 } 2168 }
2163 _parent_scene.geom_name_map[prim_geom] = oldname; 2169 _parent_scene.geom_name_map[prim_geom] = oldname;
2164 2170
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
index c8ae229..732e835 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
@@ -145,6 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
145 uint hitConsumerID = 0; 145 uint hitConsumerID = 0;
146 float distance = 999999999999f; 146 float distance = 999999999999f;
147 Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f); 147 Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f);
148 Vector3 snormal = Vector3.Zero;
148 149
149 // Find closest contact and object. 150 // Find closest contact and object.
150 lock (m_contactResults) 151 lock (m_contactResults)
@@ -157,6 +158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
157 hitConsumerID = cResult.ConsumerID; 158 hitConsumerID = cResult.ConsumerID;
158 distance = cResult.Depth; 159 distance = cResult.Depth;
159 hitYN = true; 160 hitYN = true;
161 snormal = cResult.Normal;
160 } 162 }
161 } 163 }
162 164
@@ -165,7 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
165 167
166 // Return results 168 // Return results
167 if (req.callbackMethod != null) 169 if (req.callbackMethod != null)
168 req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance); 170 req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal);
169 } 171 }
170 172
171 // This is the standard Near. Uses space AABBs to speed up detection. 173 // This is the standard Near. Uses space AABBs to speed up detection.
@@ -310,7 +312,8 @@ namespace OpenSim.Region.Physics.OdePlugin
310 collisionresult.ConsumerID = ((OdePrim)p1).m_localID; 312 collisionresult.ConsumerID = ((OdePrim)p1).m_localID;
311 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); 313 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
312 collisionresult.Depth = contacts[i].depth; 314 collisionresult.Depth = contacts[i].depth;
313 315 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
316 contacts[i].normal.Z);
314 lock (m_contactResults) 317 lock (m_contactResults)
315 m_contactResults.Add(collisionresult); 318 m_contactResults.Add(collisionresult);
316 } 319 }
@@ -325,6 +328,8 @@ namespace OpenSim.Region.Physics.OdePlugin
325 collisionresult.ConsumerID = ((OdePrim)p2).m_localID; 328 collisionresult.ConsumerID = ((OdePrim)p2).m_localID;
326 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); 329 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
327 collisionresult.Depth = contacts[i].depth; 330 collisionresult.Depth = contacts[i].depth;
331 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
332 contacts[i].normal.Z);
328 333
329 lock (m_contactResults) 334 lock (m_contactResults)
330 m_contactResults.Add(collisionresult); 335 m_contactResults.Add(collisionresult);
@@ -358,5 +363,6 @@ namespace OpenSim.Region.Physics.OdePlugin
358 public Vector3 Pos; 363 public Vector3 Pos;
359 public float Depth; 364 public float Depth;
360 public uint ConsumerID; 365 public uint ConsumerID;
366 public Vector3 Normal;
361 } 367 }
362} 368}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index a0aba2a..0384d6e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -207,6 +207,7 @@ namespace OpenSim.Region.Physics.OdePlugin
207 private float avMovementDivisorWalk = 1.3f; 207 private float avMovementDivisorWalk = 1.3f;
208 private float avMovementDivisorRun = 0.8f; 208 private float avMovementDivisorRun = 0.8f;
209 private float minimumGroundFlightOffset = 3f; 209 private float minimumGroundFlightOffset = 3f;
210 public float maximumMassObject = 10000.01f;
210 211
211 public bool meshSculptedPrim = true; 212 public bool meshSculptedPrim = true;
212 public bool forceSimplePrimMeshing = false; 213 public bool forceSimplePrimMeshing = false;
@@ -480,6 +481,7 @@ namespace OpenSim.Region.Physics.OdePlugin
480 481
481 m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); 482 m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
482 minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); 483 minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
484 maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f);
483 } 485 }
484 } 486 }
485 487