aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorTeravus Ovares2009-03-07 00:27:56 +0000
committerTeravus Ovares2009-03-07 00:27:56 +0000
commit3a93bb992fade04a463d6cd91bc014b110e217a5 (patch)
treeb95ef31af1cb58bfec63e2639f2de0f7eaa0f165 /OpenSim/Region/Physics/OdePlugin
parentFixes Mantis #3260. Thank you kindly, MCortez for a patch that: (diff)
downloadopensim-SC-3a93bb992fade04a463d6cd91bc014b110e217a5.zip
opensim-SC-3a93bb992fade04a463d6cd91bc014b110e217a5.tar.gz
opensim-SC-3a93bb992fade04a463d6cd91bc014b110e217a5.tar.bz2
opensim-SC-3a93bb992fade04a463d6cd91bc014b110e217a5.tar.xz
* Added some limits to the maximum force applied per second by llMoveToTarget. Currently, it's 350 times the mass in newtons applied per second, maximum.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs19
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs10
2 files changed, 27 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index f164048..3291b79 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1500,6 +1500,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1500 1500
1501 if (m_usePID) 1501 if (m_usePID)
1502 { 1502 {
1503 //if (!d.BodyIsEnabled(Body))
1504 //d.BodySetForce(Body, 0f, 0f, 0f);
1503 // If we're using the PID controller, then we have no gravity 1505 // If we're using the PID controller, then we have no gravity
1504 fz = (-1 * _parent_scene.gravityz) * m_mass; 1506 fz = (-1 * _parent_scene.gravityz) * m_mass;
1505 1507
@@ -1510,7 +1512,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1510 1512
1511 if ((m_PIDTau < 1)) 1513 if ((m_PIDTau < 1))
1512 { 1514 {
1513 PID_G = PID_G / m_PIDTau; 1515 //PID_G = PID_G / m_PIDTau;
1516 m_PIDTau = 1;
1514 } 1517 }
1515 1518
1516 if ((PID_G - m_PIDTau) <= 0) 1519 if ((PID_G - m_PIDTau) <= 0)
@@ -1668,6 +1671,20 @@ namespace OpenSim.Region.Physics.OdePlugin
1668 d.BodySetForce(Body, 0, 0, 0); 1671 d.BodySetForce(Body, 0, 0, 0);
1669 enableBodySoft(); 1672 enableBodySoft();
1670 } 1673 }
1674
1675 // 35x10 = 350n times the mass per second applied maximum.
1676 float nmax = 35f * m_mass;
1677 float nmin = -35f * m_mass;
1678
1679
1680 if (fx > nmax)
1681 fx = nmax;
1682 if (fx < nmin)
1683 fx = nmin;
1684 if (fy > nmax)
1685 fy = nmax;
1686 if (fy < nmin)
1687 fy = nmin;
1671 d.BodyAddForce(Body, fx, fy, fz); 1688 d.BodyAddForce(Body, fx, fy, fz);
1672 } 1689 }
1673 } 1690 }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b94f374..0a6faa8 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -482,6 +482,12 @@ namespace OpenSim.Region.Physics.OdePlugin
482 d.WorldSetGravity(world, gravityx, gravityy, gravityz); 482 d.WorldSetGravity(world, gravityx, gravityy, gravityz);
483 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); 483 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
484 484
485 d.WorldSetLinearDamping(world, 256f);
486 d.WorldSetAngularDamping(world, 256f);
487 d.WorldSetAngularDampingThreshold(world, 256f);
488 d.WorldSetLinearDampingThreshold(world, 256f);
489 d.WorldSetMaxAngularSpeed(world, 256f);
490
485 // Set how many steps we go without running collision testing 491 // Set how many steps we go without running collision testing
486 // This is in addition to the step size. 492 // This is in addition to the step size.
487 // Essentially Steps * m_physicsiterations 493 // Essentially Steps * m_physicsiterations
@@ -2296,9 +2302,11 @@ namespace OpenSim.Region.Physics.OdePlugin
2296 2302
2297 // Figure out the Frames Per Second we're going at. 2303 // Figure out the Frames Per Second we're going at.
2298 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size 2304 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
2299 step_time = 0.09375f; 2305
2300 fps = (step_time/ODE_STEPSIZE) * 1000; 2306 fps = (step_time/ODE_STEPSIZE) * 1000;
2301 2307
2308 step_time = 0.09375f;
2309
2302 while (step_time > 0.0f) 2310 while (step_time > 0.0f)
2303 { 2311 {
2304 //lock (ode) 2312 //lock (ode)