aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs50
1 files changed, 46 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index b7e4302..bd28dda 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -627,6 +627,40 @@ namespace OpenSim.Region.Physics.OdePlugin
627 } 627 }
628 returnMass = m_density*volume; 628 returnMass = m_density*volume;
629 if (returnMass <= 0) returnMass = 0.0001f;//ckrinke: Mass must be greater then zero. 629 if (returnMass <= 0) returnMass = 0.0001f;//ckrinke: Mass must be greater then zero.
630
631
632
633 // Recursively calculate mass
634 bool HasChildPrim = false;
635 lock (childrenPrim)
636 {
637 if (childrenPrim.Count > 0)
638 {
639 HasChildPrim = true;
640 }
641
642 }
643 if (HasChildPrim)
644 {
645 OdePrim[] childPrimArr = new OdePrim[0];
646
647 lock (childrenPrim)
648 childPrimArr = childrenPrim.ToArray();
649
650 for (int i = 0; i < childPrimArr.Length; i++)
651 {
652 if (childPrimArr[i] != null && !childPrimArr[i].m_taintremove)
653 returnMass += childPrimArr[i].CalculateMass();
654 // failsafe, this shouldn't happen but with OpenSim, you never know :)
655 if (i > 256)
656 break;
657 }
658 }
659
660
661
662
663
630 return returnMass; 664 return returnMass;
631 } 665 }
632 666
@@ -843,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
843 } 877 }
844 } 878 }
845 // Store this for later in case we get turned into a separate body 879 // Store this for later in case we get turned into a separate body
846 m_angularlock = new PhysicsVector(m_taintAngularLock.X,m_angularlock.Y,m_angularlock.Z); 880 m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
847 } 881 }
848 882
849 private void changelink(float timestep) 883 private void changelink(float timestep)
@@ -1160,6 +1194,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1160 if (Body != IntPtr.Zero) 1194 if (Body != IntPtr.Zero)
1161 { 1195 {
1162 d.BodySetLinearVel(Body, 0f, 0f, 0f); 1196 d.BodySetLinearVel(Body, 0f, 0f, 0f);
1197 d.BodySetForce(Body, 0, 0, 0);
1163 enableBodySoft(); 1198 enableBodySoft();
1164 } 1199 }
1165 } 1200 }
@@ -1394,7 +1429,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1394 if (m_usePID) 1429 if (m_usePID)
1395 { 1430 {
1396 // If we're using the PID controller, then we have no gravity 1431 // If we're using the PID controller, then we have no gravity
1397 fz = (-1 * _parent_scene.gravityz) * this.Mass; 1432 fz = (-1 * _parent_scene.gravityz) * m_mass;
1398 1433
1399 // no lock; for now it's only called from within Simulate() 1434 // no lock; for now it's only called from within Simulate()
1400 1435
@@ -1470,7 +1505,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1470 //m_taintdisable = true; 1505 //m_taintdisable = true;
1471 //base.RaiseOutOfBounds(Position); 1506 //base.RaiseOutOfBounds(Position);
1472 //d.BodySetLinearVel(Body, fx, fy, 0f); 1507 //d.BodySetLinearVel(Body, fx, fy, 0f);
1473 enableBodySoft(); 1508 if (!d.BodyIsEnabled(Body))
1509 {
1510 d.BodySetLinearVel(Body, 0f, 0f, 0f);
1511 d.BodySetForce(Body, 0, 0, 0);
1512 enableBodySoft();
1513 }
1474 d.BodyAddForce(Body, fx, fy, fz); 1514 d.BodyAddForce(Body, fx, fy, fz);
1475 } 1515 }
1476 } 1516 }
@@ -2234,6 +2274,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2234 axis.X = (axis.X > 0) ? 1f : 0f; 2274 axis.X = (axis.X > 0) ? 1f : 0f;
2235 axis.Y = (axis.Y > 0) ? 1f : 0f; 2275 axis.Y = (axis.Y > 0) ? 1f : 0f;
2236 axis.Z = (axis.Z > 0) ? 1f : 0f; 2276 axis.Z = (axis.Z > 0) ? 1f : 0f;
2277 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
2237 m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); ; 2278 m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); ;
2238 } 2279 }
2239 2280
@@ -2455,6 +2496,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2455 float axisnum = 3; 2496 float axisnum = 3;
2456 2497
2457 axisnum = (axisnum - (axis.X + axis.Y + axis.Z)); 2498 axisnum = (axisnum - (axis.X + axis.Y + axis.Z));
2499
2458 2500
2459 if (axisnum <= 0) 2501 if (axisnum <= 0)
2460 return; 2502 return;
@@ -2502,7 +2544,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2502 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); 2544 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
2503 2545
2504 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); 2546 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
2505 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor); 2547 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor * 5);//
2506 } 2548 }
2507 2549
2508 public override void SubscribeEvents(int ms) 2550 public override void SubscribeEvents(int ms)