aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorRobert Adams2013-01-25 12:00:19 -0800
committerRobert Adams2013-01-27 12:50:05 -0800
commitdd08e1fba6e154002a7fe8f46c8c01e6e61d39db (patch)
tree0522733b5a8c999d008b0fc04992e6c081a2c48c /OpenSim/Region/Physics/BulletSPlugin
parentBulletSim: finish the post step event for physical object actions. Modify veh... (diff)
downloadopensim-SC_OLD-dd08e1fba6e154002a7fe8f46c8c01e6e61d39db.zip
opensim-SC_OLD-dd08e1fba6e154002a7fe8f46c8c01e6e61d39db.tar.gz
opensim-SC_OLD-dd08e1fba6e154002a7fe8f46c8c01e6e61d39db.tar.bz2
opensim-SC_OLD-dd08e1fba6e154002a7fe8f46c8c01e6e61d39db.tar.xz
BulletSim: parameterize several vehicle debugging values: physical linear and angular force factors now default to less than 1 (0.2) vehicle friction and restitution now default to low values
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs45
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt9
3 files changed, 57 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index a369c1f..5c531fc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -583,8 +583,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
583 583
584 // Some of the properties of this prim may have changed. 584 // Some of the properties of this prim may have changed.
585 // Do any updating needed for a vehicle 585 // Do any updating needed for a vehicle
586 Vector3 m_physicsLinearFactor = new Vector3(0.2f, 0.2f, 0.2f); // DEBUG DEBUG
587 Vector3 m_physicsAngularFactor = new Vector3(0.2f, 0.2f, 0.2f); // DEBUG DEBUG
588 public void Refresh() 586 public void Refresh()
589 { 587 {
590 if (IsActive) 588 if (IsActive)
@@ -593,16 +591,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
593 m_vehicleMass = Prim.Linkset.LinksetMass; 591 m_vehicleMass = Prim.Linkset.LinksetMass;
594 592
595 // Friction affects are handled by this vehicle code 593 // Friction affects are handled by this vehicle code
596 float friction = 0f; 594 PhysicsScene.PE.SetFriction(Prim.PhysBody, BSParam.VehicleFriction);
597 PhysicsScene.PE.SetFriction(Prim.PhysBody, friction); 595 PhysicsScene.PE.SetRestitution(Prim.PhysBody, BSParam.VehicleRestitution);
598 596
599 // Moderate angular movement introduced by Bullet. 597 // Moderate angular movement introduced by Bullet.
600 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 598 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
601 // Maybe compute linear and angular factor and damping from params. 599 // Maybe compute linear and angular factor and damping from params.
602 float angularDamping = BSParam.VehicleAngularDamping; 600 float angularDamping = BSParam.VehicleAngularDamping;
603 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, angularDamping); 601 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, angularDamping);
604 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, m_physicsLinearFactor); // DEBUG DEBUG 602 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactorV);
605 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, m_physicsAngularFactor); // DEBUG DEBUG 603 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactorV);
606 604
607 // Vehicles report collision events so we know when it's on the ground 605 // Vehicles report collision events so we know when it's on the ground
608 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 606 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
@@ -618,7 +616,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
618 PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); 616 PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero);
619 617
620 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4},grav={5}", 618 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4},grav={5}",
621 Prim.LocalID, m_vehicleMass, friction, Prim.Inertia, angularDamping, m_VehicleGravity); 619 Prim.LocalID, m_vehicleMass, Prim.Inertia, angularDamping, m_VehicleGravity);
622 } 620 }
623 else 621 else
624 { 622 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 06186b0..8de8905 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -82,9 +82,34 @@ public static class BSParam
82 public static float AvatarStepApproachFactor { get; private set; } 82 public static float AvatarStepApproachFactor { get; private set; }
83 public static float AvatarStepForceFactor { get; private set; } 83 public static float AvatarStepForceFactor { get; private set; }
84 84
85 // Vehicle parameters
85 public static float VehicleMaxLinearVelocity { get; private set; } 86 public static float VehicleMaxLinearVelocity { get; private set; }
86 public static float VehicleMaxAngularVelocity { get; private set; } 87 public static float VehicleMaxAngularVelocity { get; private set; }
87 public static float VehicleAngularDamping { get; private set; } 88 public static float VehicleAngularDamping { get; private set; }
89 public static float VehicleFriction { get; private set; }
90 public static float VehicleRestitution { get; private set; }
91 public static float VehicleLinearFactor { get; private set; }
92 private static Vector3? vehicleLinearFactorV;
93 public static Vector3 VehicleLinearFactorV
94 {
95 get
96 {
97 if (!vehicleLinearFactorV.HasValue)
98 vehicleLinearFactorV = new Vector3(VehicleLinearFactor, VehicleLinearFactor, VehicleLinearFactor);
99 return (Vector3)vehicleLinearFactorV;
100 }
101 }
102 public static float VehicleAngularFactor { get; private set; }
103 private static Vector3? vehicleAngularFactorV;
104 public static Vector3 VehicleAngularFactorV
105 {
106 get
107 {
108 if (!vehicleAngularFactorV.HasValue)
109 vehicleAngularFactorV = new Vector3(VehicleAngularFactor, VehicleAngularFactor, VehicleAngularFactor);
110 return (Vector3)vehicleAngularFactorV;
111 }
112 }
88 public static float VehicleDebuggingEnabled { get; private set; } 113 public static float VehicleDebuggingEnabled { get; private set; }
89 114
90 public static float LinksetImplementation { get; private set; } 115 public static float LinksetImplementation { get; private set; }
@@ -454,6 +479,26 @@ public static class BSParam
454 (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, 479 (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); },
455 (s) => { return VehicleAngularDamping; }, 480 (s) => { return VehicleAngularDamping; },
456 (s,p,l,v) => { VehicleAngularDamping = v; } ), 481 (s,p,l,v) => { VehicleAngularDamping = v; } ),
482 new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)",
483 0.2f,
484 (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); },
485 (s) => { return VehicleLinearFactor; },
486 (s,p,l,v) => { VehicleLinearFactor = v; } ),
487 new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)",
488 0.2f,
489 (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); },
490 (s) => { return VehicleAngularFactor; },
491 (s,p,l,v) => { VehicleAngularFactor = v; } ),
492 new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
493 0.0f,
494 (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); },
495 (s) => { return VehicleFriction; },
496 (s,p,l,v) => { VehicleFriction = v; } ),
497 new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
498 0.0f,
499 (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); },
500 (s) => { return VehicleRestitution; },
501 (s,p,l,v) => { VehicleRestitution = v; } ),
457 new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", 502 new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
458 ConfigurationParameters.numericFalse, 503 ConfigurationParameters.numericFalse,
459 (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 504 (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 801f690..7917795 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -2,7 +2,6 @@ CURRENT PRIORITIES
2================================================= 2=================================================
3Deleting a linkset while standing on the root will leave the physical shape of the root behind. 3Deleting a linkset while standing on the root will leave the physical shape of the root behind.
4 Not sure if it is because standing on it. Done with large prim linksets. 4 Not sure if it is because standing on it. Done with large prim linksets.
5Child movement in linkset (don't rebuild linkset)
6Vehicle angular vertical attraction 5Vehicle angular vertical attraction
7vehicle angular banking 6vehicle angular banking
8Center-of-gravity 7Center-of-gravity
@@ -12,6 +11,7 @@ when should angular and linear motor targets be zeroed? when selected?
12 Need a vehicle.clear()? Or an 'else' in prestep if not physical. 11 Need a vehicle.clear()? Or an 'else' in prestep if not physical.
13Teravus llMoveToTarget script debug 12Teravus llMoveToTarget script debug
14 Mixing of hover, buoyancy/gravity, moveToTarget, into one force 13 Mixing of hover, buoyancy/gravity, moveToTarget, into one force
14 Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
15Nebadon vehicles turning funny in arena 15Nebadon vehicles turning funny in arena
16limitMotorUp calibration (more down?) 16limitMotorUp calibration (more down?)
17llRotLookAt 17llRotLookAt
@@ -72,7 +72,11 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
72 72
73GENERAL TODO LIST: 73GENERAL TODO LIST:
74================================================= 74=================================================
75Avatar standing on a moving object should start to move with the object.
75llMoveToTarget objects are not effected by gravity until target is removed. 76llMoveToTarget objects are not effected by gravity until target is removed.
77Compute CCD parameters based on body size
78Can solver iterations be changed per body/shape? Can be for constraints but what
79 about regular vehicles?
76Implement llSetPhysicalMaterial. 80Implement llSetPhysicalMaterial.
77 extend it with Center-of-mass, rolling friction, density 81 extend it with Center-of-mass, rolling friction, density
78Implement llSetForceAndTorque. 82Implement llSetForceAndTorque.
@@ -321,4 +325,5 @@ Mantis 6040 script http://opensimulator.org/mantis/view.php?id=6040 (DONE)
321Boats float low in the water (DONE) 325Boats float low in the water (DONE)
322Boats floating at proper level (DONE) 326Boats floating at proper level (DONE)
323When is force introduced by SetForce removed? The prestep action could go forever. (DONE) 327When is force introduced by SetForce removed? The prestep action could go forever. (DONE)
324 (Resolution: setForce registers a prestep action which keeps applying the force) \ No newline at end of file 328 (Resolution: setForce registers a prestep action which keeps applying the force)
329Child movement in linkset (don't rebuild linkset) (DONE 20130122)) \ No newline at end of file