aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEVehicleSettings.cs31
1 files changed, 24 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEVehicleSettings.cs b/OpenSim/Region/Physics/OdePlugin/ODEVehicleSettings.cs
index bbd19c8..a4b93a0 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEVehicleSettings.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEVehicleSettings.cs
@@ -49,6 +49,9 @@ namespace OpenSim.Region.Physics.OdePlugin
49 get { return m_body; } 49 get { return m_body; }
50 } 50 }
51 51
52 private int frcount = 0;
53 private float frmod = 3.0f;
54
52 private Vehicle m_type = Vehicle.TYPE_NONE; 55 private Vehicle m_type = Vehicle.TYPE_NONE;
53 private OdeScene m_parentScene = null; 56 private OdeScene m_parentScene = null;
54 private IntPtr m_body = IntPtr.Zero; 57 private IntPtr m_body = IntPtr.Zero;
@@ -312,9 +315,16 @@ namespace OpenSim.Region.Physics.OdePlugin
312 { 315 {
313 if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE) 316 if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE)
314 return; 317 return;
318 frcount++;
319 if (frcount > 100)
320 frcount = 0;
321
315 VerticalAttractor(pTimestep); 322 VerticalAttractor(pTimestep);
316 LinearMotor(pTimestep); 323 LinearMotor(pTimestep);
324
325
317 AngularMotor(pTimestep); 326 AngularMotor(pTimestep);
327
318 } 328 }
319 329
320 private void SetDefaultsForType(Vehicle pType) 330 private void SetDefaultsForType(Vehicle pType)
@@ -473,11 +483,16 @@ namespace OpenSim.Region.Physics.OdePlugin
473 d.BodyGetRelPointPos(m_body, 0.0f, 0.0f, -1.0f, out feet); 483 d.BodyGetRelPointPos(m_body, 0.0f, 0.0f, -1.0f, out feet);
474 d.BodyGetRelPointPos(m_body, 0.0f, 0.0f, 1.0f, out head); 484 d.BodyGetRelPointPos(m_body, 0.0f, 0.0f, 1.0f, out head);
475 float posture = head.Z - feet.Z; 485 float posture = head.Z - feet.Z;
486
487 //Console.WriteLine(String.Format("head: <{0},{1},{2}>, feet:<{3},{4},{5}> diff:<{6},{7},{8}>", head.X, head.Y, head.Z, feet.X,
488 // feet.Y, feet.Z, head.X - feet.X, head.Y - feet.Y, head.Z - feet.Z));
489 //Console.WriteLine(String.Format("diff:<{0},{1},{2}>",head.X - feet.X, head.Y - feet.Y, head.Z - feet.Z));
476 490
477 // restoring force proportional to lack of posture: 491 // restoring force proportional to lack of posture:
478 float servo = (2.5f - posture) * (objMass.mass * m_verticalAttractionEfficiency / (m_verticalAttractionTimescale * pTimestep)) * objMass.mass; 492 float servo = (2.5f - posture) * (objMass.mass * m_verticalAttractionEfficiency / (m_verticalAttractionTimescale * pTimestep)) * objMass.mass;
479 d.BodyAddForceAtRelPos(m_body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 493 d.BodyAddForceAtRelPos(m_body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
480 d.BodyAddForceAtRelPos(m_body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 494 d.BodyAddForceAtRelPos(m_body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
495 //d.BodyAddTorque(m_body, (head.X - feet.X) * servo, (head.Y - feet.Y) * servo, (head.Z - feet.Z) * servo);
481 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); 496 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
482 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 497 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
483 } 498 }
@@ -575,20 +590,21 @@ namespace OpenSim.Region.Physics.OdePlugin
575 } 590 }
576 private void SetAngularMotorProperties() 591 private void SetAngularMotorProperties()
577 { 592 {
578
579
580 593
594
595
581 d.Mass objMass; 596 d.Mass objMass;
582 d.BodyGetMass(Body, out objMass); 597 d.BodyGetMass(Body, out objMass);
583 d.Quaternion rot = d.BodyGetQuaternion(Body); 598 //d.Quaternion rot = d.BodyGetQuaternion(Body);
584 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); 599 //Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
585 Vector3 axis0 = Vector3.UnitX; 600 Vector3 axis0 = Vector3.UnitX;
586 Vector3 axis1 = Vector3.UnitY; 601 Vector3 axis1 = Vector3.UnitY;
587 Vector3 axis2 = Vector3.UnitZ; 602 Vector3 axis2 = Vector3.UnitZ;
588 axis0 *= rotq; 603 //axis0 *= rotq;
589 axis1 *= rotq; 604 //axis1 *= rotq;
590 axis2 *= rotq; 605 //axis2 *= rotq;
591 606
607
592 608
593 if (m_aMotor != IntPtr.Zero) 609 if (m_aMotor != IntPtr.Zero)
594 { 610 {
@@ -604,5 +620,6 @@ namespace OpenSim.Region.Physics.OdePlugin
604 620
605 } 621 }
606 } 622 }
623
607 } 624 }
608} 625}