aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorMelanie2012-12-28 08:32:34 +0000
committerMelanie2012-12-28 08:32:34 +0000
commit3ab1bd04031ca0bc1039e4e1d267ea19d0017430 (patch)
tree3f2417f3b96e151642158d29d1982dee2bd850a8 /OpenSim/Region/Physics/BulletSPlugin
parentMerge branch 'master' into careminster (diff)
parentBulletSim: correct collision mask definition for linkset children. (diff)
downloadopensim-SC-3ab1bd04031ca0bc1039e4e1d267ea19d0017430.zip
opensim-SC-3ab1bd04031ca0bc1039e4e1d267ea19d0017430.tar.gz
opensim-SC-3ab1bd04031ca0bc1039e4e1d267ea19d0017430.tar.bz2
opensim-SC-3ab1bd04031ca0bc1039e4e1d267ea19d0017430.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs66
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs9
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs16
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMotors.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs17
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs37
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs94
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs23
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs24
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs27
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt34
11 files changed, 224 insertions, 127 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index bf0545a..3f7b5e1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -260,7 +260,6 @@ public sealed class BSCharacter : BSPhysObject
260 public override void ZeroMotion(bool inTaintTime) 260 public override void ZeroMotion(bool inTaintTime)
261 { 261 {
262 _velocity = OMV.Vector3.Zero; 262 _velocity = OMV.Vector3.Zero;
263 _velocityMotor.Zero();
264 _acceleration = OMV.Vector3.Zero; 263 _acceleration = OMV.Vector3.Zero;
265 _rotationalVelocity = OMV.Vector3.Zero; 264 _rotationalVelocity = OMV.Vector3.Zero;
266 265
@@ -585,18 +584,6 @@ public sealed class BSCharacter : BSPhysObject
585 get { return _throttleUpdates; } 584 get { return _throttleUpdates; }
586 set { _throttleUpdates = value; } 585 set { _throttleUpdates = value; }
587 } 586 }
588 public override bool IsColliding {
589 get { return (CollidingStep == PhysicsScene.SimulationStep); }
590 set { _isColliding = value; }
591 }
592 public override bool CollidingGround {
593 get { return (CollidingGroundStep == PhysicsScene.SimulationStep); }
594 set { CollidingGround = value; }
595 }
596 public override bool CollidingObj {
597 get { return _collidingObj; }
598 set { _collidingObj = value; }
599 }
600 public override bool FloatOnWater { 587 public override bool FloatOnWater {
601 set { 588 set {
602 _floatOnWater = value; 589 _floatOnWater = value;
@@ -684,22 +671,31 @@ public sealed class BSCharacter : BSPhysObject
684 public override void AddForce(OMV.Vector3 force, bool pushforce) { 671 public override void AddForce(OMV.Vector3 force, bool pushforce) {
685 if (force.IsFinite()) 672 if (force.IsFinite())
686 { 673 {
687 _force.X += force.X; 674 float magnitude = force.Length();
688 _force.Y += force.Y; 675 if (magnitude > BSParam.MaxAddForceMagnitude)
689 _force.Z += force.Z; 676 {
690 // m_log.DebugFormat("{0}: AddForce. adding={1}, newForce={2}", LogHeader, force, _force); 677 // Force has a limit
678 force = force / magnitude * BSParam.MaxAddForceMagnitude;
679 }
680
681 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
682 DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce);
683
691 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() 684 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
692 { 685 {
693 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 686 // Bullet adds this central force to the total force for this tick
687 DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
694 if (PhysBody.HasPhysicalBody) 688 if (PhysBody.HasPhysicalBody)
695 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 689 {
690 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce);
691 }
696 }); 692 });
697 } 693 }
698 else 694 else
699 { 695 {
700 m_log.ErrorFormat("{0}: Got a NaN force applied to a Character", LogHeader); 696 m_log.WarnFormat("{0}: Got a NaN force applied to a character. LocalID={1}", LogHeader, LocalID);
697 return;
701 } 698 }
702 //m_lastUpdateSent = false;
703 } 699 }
704 700
705 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { 701 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) {
@@ -761,22 +757,26 @@ public sealed class BSCharacter : BSPhysObject
761 757
762 OMV.Vector3 stepVelocity = _velocityMotor.Step(PhysicsScene.LastTimeStep); 758 OMV.Vector3 stepVelocity = _velocityMotor.Step(PhysicsScene.LastTimeStep);
763 759
764 // If falling, we keep the world's downward vector no matter what the other axis specify. 760 // Check for cases to turn off the motor.
765 if (!Flying && !IsColliding) 761 if (
766 { 762 // If the walking motor is all done, turn it off
767 stepVelocity.Z = entprop.Velocity.Z; 763 (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero) )
768 DetailLog("{0},BSCharacter.UpdateProperties,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
769 }
770
771 // If the user has said stop and we've stopped applying velocity correction,
772 // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer.
773 if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero)
774 { 764 {
775 _velocityMotor.Enabled = false;
776 stepVelocity = OMV.Vector3.Zero;
777 ZeroMotion(true); 765 ZeroMotion(true);
766 stepVelocity = OMV.Vector3.Zero;
767 _velocityMotor.Enabled = false;
778 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor); 768 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor);
779 } 769 }
770 else
771 {
772 // If the motor is not being turned off...
773 // If falling, we keep the world's downward vector no matter what the other axis specify.
774 if (!Flying && !IsColliding)
775 {
776 stepVelocity.Z = entprop.Velocity.Z;
777 DetailLog("{0},BSCharacter.UpdateProperties,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
778 }
779 }
780 780
781 _velocity = stepVelocity; 781 _velocity = stepVelocity;
782 entprop.Velocity = _velocity; 782 entprop.Velocity = _velocity;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 3fde57b..0bdfbe3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -573,6 +573,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); 573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
574 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); 574 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr);
575 575
576 Vector3 grav = PhysicsScene.DefaultGravity * (1f - Prim.Buoyancy);
577 BulletSimAPI.SetGravity2(Prim.PhysBody.ptr, grav);
578
576 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}", 579 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}",
577 Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping); 580 Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping);
578 } 581 }
@@ -819,6 +822,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
819 { 822 {
820 if (!IsActive) return; 823 if (!IsActive) return;
821 824
825 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
826 BulletSimAPI.DumpRigidBody2(PhysicsScene.World.ptr, Prim.PhysBody.ptr);
827
822 ForgetKnownVehicleProperties(); 828 ForgetKnownVehicleProperties();
823 829
824 MoveLinear(pTimestep); 830 MoveLinear(pTimestep);
@@ -833,6 +839,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
833 // for the physics engine to note the changes so an UpdateProperties event will happen. 839 // for the physics engine to note the changes so an UpdateProperties event will happen.
834 PushKnownChanged(); 840 PushKnownChanged();
835 841
842 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
843 BulletSimAPI.DumpRigidBody2(PhysicsScene.World.ptr, Prim.PhysBody.ptr);
844
836 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", 845 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
837 Prim.LocalID, VehiclePosition, Prim.Force, VehicleVelocity, VehicleRotationalVelocity); 846 Prim.LocalID, VehiclePosition, Prim.Force, VehicleVelocity, VehicleRotationalVelocity);
838 } 847 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index d5cbf5f..19ce62b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -5,7 +5,7 @@
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclat simer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD 9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
@@ -98,11 +98,12 @@ public sealed class BSLinksetCompound : BSLinkset
98 // Schedule a refresh to happen after all the other taint processing. 98 // Schedule a refresh to happen after all the other taint processing.
99 private void ScheduleRebuild(BSPhysObject requestor) 99 private void ScheduleRebuild(BSPhysObject requestor)
100 { 100 {
101 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1}", 101 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2}",
102 requestor.LocalID, Rebuilding); 102 requestor.LocalID, Rebuilding, HasAnyChildren);
103 // When rebuilding, it is possible to set properties that would normally require a rebuild. 103 // When rebuilding, it is possible to set properties that would normally require a rebuild.
104 // If already rebuilding, don't request another rebuild. 104 // If already rebuilding, don't request another rebuild.
105 if (!Rebuilding) 105 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
106 if (!Rebuilding && HasAnyChildren)
106 { 107 {
107 PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() 108 PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
108 { 109 {
@@ -112,8 +113,7 @@ public sealed class BSLinksetCompound : BSLinkset
112 } 113 }
113 } 114 }
114 115
115 // The object is going dynamic (physical). Do any setup necessary 116 // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset.
116 // for a dynamic linkset.
117 // Only the state of the passed object can be modified. The rest of the linkset 117 // Only the state of the passed object can be modified. The rest of the linkset
118 // has not yet been fully constructed. 118 // has not yet been fully constructed.
119 // Return 'true' if any properties updated on the passed object. 119 // Return 'true' if any properties updated on the passed object.
@@ -124,7 +124,7 @@ public sealed class BSLinksetCompound : BSLinkset
124 DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); 124 DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child));
125 if (IsRoot(child)) 125 if (IsRoot(child))
126 { 126 {
127 // The root is going dynamic. Make sure mass is properly set. 127 // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly.
128 ScheduleRebuild(LinksetRoot); 128 ScheduleRebuild(LinksetRoot);
129 } 129 }
130 else 130 else
@@ -378,7 +378,7 @@ public sealed class BSLinksetCompound : BSLinkset
378 }); 378 });
379 379
380 // With all of the linkset packed into the root prim, it has the mass of everyone. 380 // With all of the linkset packed into the root prim, it has the mass of everyone.
381 LinksetMass = LinksetMass; 381 LinksetMass = ComputeLinksetMass();
382 LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true); 382 LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true);
383 } 383 }
384 finally 384 finally
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
index 9e1a9ba..817a5f7 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
@@ -241,8 +241,8 @@ public class BSVMotor : BSMotor
241 241
242 public override string ToString() 242 public override string ToString()
243 { 243 {
244 return String.Format("<{0},curr={1},targ={2},decayTS={3},frictTS={4}>", 244 return String.Format("<{0},curr={1},targ={2},lastErr={3},decayTS={4},frictTS={5}>",
245 UseName, CurrentValue, TargetValue, TargetValueDecayTimeScale, FrictionTimescale); 245 UseName, CurrentValue, TargetValue, LastError, TargetValueDecayTimeScale, FrictionTimescale);
246 } 246 }
247} 247}
248 248
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 7454718..f8f24bd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -89,6 +89,18 @@ public static class BSParam
89 public static float PID_D { get; private set; } // derivative 89 public static float PID_D { get; private set; } // derivative
90 public static float PID_P { get; private set; } // proportional 90 public static float PID_P { get; private set; } // proportional
91 91
92 // Various constants that come from that other virtual world that shall not be named
93 public const float MinGravityZ = -1f;
94 public const float MaxGravityZ = 28f;
95 public const float MinFriction = 0f;
96 public const float MaxFriction = 255f;
97 public const float MinDensity = 0f;
98 public const float MaxDensity = 22587f;
99 public const float MinRestitution = 0f;
100 public const float MaxRestitution = 1f;
101 public const float MaxAddForceMagnitude = 20000f;
102
103 // ===========================================================================
92 public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); 104 public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val);
93 public delegate float ParamGet(BSScene scene); 105 public delegate float ParamGet(BSScene scene);
94 public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); 106 public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val);
@@ -200,6 +212,11 @@ public static class BSParam
200 (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, 212 (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); },
201 (s) => { return (float)s.m_fixedTimeStep; }, 213 (s) => { return (float)s.m_fixedTimeStep; },
202 (s,p,l,v) => { s.m_fixedTimeStep = v; } ), 214 (s,p,l,v) => { s.m_fixedTimeStep = v; } ),
215 new ParameterDefn("NominalFrameRate", "The base frame rate we claim",
216 55f,
217 (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); },
218 (s) => { return (float)s.NominalFrameRate; },
219 (s,p,l,v) => { s.NominalFrameRate = (int)v; } ),
203 new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", 220 new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame",
204 2048f, 221 2048f,
205 (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, 222 (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 4bed535..73b5764 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -182,9 +182,40 @@ public abstract class BSPhysObject : PhysicsActor
182 protected long CollidingStep { get; set; } 182 protected long CollidingStep { get; set; }
183 // The simulation step that last had a collision with the ground 183 // The simulation step that last had a collision with the ground
184 protected long CollidingGroundStep { get; set; } 184 protected long CollidingGroundStep { get; set; }
185 // The simulation step that last collided with an object
186 protected long CollidingObjectStep { get; set; }
185 // The collision flags we think are set in Bullet 187 // The collision flags we think are set in Bullet
186 protected CollisionFlags CurrentCollisionFlags { get; set; } 188 protected CollisionFlags CurrentCollisionFlags { get; set; }
187 189
190 public override bool IsColliding {
191 get { return (CollidingStep == PhysicsScene.SimulationStep); }
192 set {
193 if (value)
194 CollidingStep = PhysicsScene.SimulationStep;
195 else
196 CollidingStep = 0;
197 }
198 }
199 public override bool CollidingGround {
200 get { return (CollidingGroundStep == PhysicsScene.SimulationStep); }
201 set
202 {
203 if (value)
204 CollidingGroundStep = PhysicsScene.SimulationStep;
205 else
206 CollidingGroundStep = 0;
207 }
208 }
209 public override bool CollidingObj {
210 get { return (CollidingObjectStep == PhysicsScene.SimulationStep); }
211 set {
212 if (value)
213 CollidingObjectStep = PhysicsScene.SimulationStep;
214 else
215 CollidingObjectStep = 0;
216 }
217 }
218
188 // The collisions that have been collected this tick 219 // The collisions that have been collected this tick
189 protected CollisionEventUpdate CollisionCollection; 220 protected CollisionEventUpdate CollisionCollection;
190 221
@@ -196,12 +227,16 @@ public abstract class BSPhysObject : PhysicsActor
196 { 227 {
197 bool ret = false; 228 bool ret = false;
198 229
199 // The following lines make IsColliding() and IsCollidingGround() work 230 // The following lines make IsColliding(), CollidingGround() and CollidingObj work
200 CollidingStep = PhysicsScene.SimulationStep; 231 CollidingStep = PhysicsScene.SimulationStep;
201 if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID) 232 if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID)
202 { 233 {
203 CollidingGroundStep = PhysicsScene.SimulationStep; 234 CollidingGroundStep = PhysicsScene.SimulationStep;
204 } 235 }
236 else
237 {
238 CollidingObjectStep = PhysicsScene.SimulationStep;
239 }
205 240
206 // prims in the same linkset cannot collide with each other 241 // prims in the same linkset cannot collide with each other
207 if (collidee != null && (this.Linkset.LinksetID == collidee.Linkset.LinksetID)) 242 if (collidee != null && (this.Linkset.LinksetID == collidee.Linkset.LinksetID))
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 159f79f..5f3f0d1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -94,7 +94,7 @@ public sealed class BSPrim : BSPhysObject
94 _size = size; 94 _size = size;
95 Scale = size; // prims are the size the user wants them to be (different for BSCharactes). 95 Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
96 _orientation = rotation; 96 _orientation = rotation;
97 _buoyancy = 1f; 97 _buoyancy = 0f;
98 _velocity = OMV.Vector3.Zero; 98 _velocity = OMV.Vector3.Zero;
99 _rotationalVelocity = OMV.Vector3.Zero; 99 _rotationalVelocity = OMV.Vector3.Zero;
100 BaseShape = pbs; 100 BaseShape = pbs;
@@ -408,12 +408,15 @@ public sealed class BSPrim : BSPhysObject
408 { 408 {
409 if (IsStatic) 409 if (IsStatic)
410 { 410 {
411 BulletSimAPI.SetGravity2(PhysBody.ptr, PhysicsScene.DefaultGravity);
411 Inertia = OMV.Vector3.Zero; 412 Inertia = OMV.Vector3.Zero;
412 BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia); 413 BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia);
413 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); 414 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
414 } 415 }
415 else 416 else
416 { 417 {
418 OMV.Vector3 grav = ComputeGravity();
419
417 if (inWorld) 420 if (inWorld)
418 { 421 {
419 // Changing interesting properties doesn't change proxy and collision cache 422 // Changing interesting properties doesn't change proxy and collision cache
@@ -422,24 +425,41 @@ public sealed class BSPrim : BSPhysObject
422 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 425 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
423 } 426 }
424 427
425 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 428 // The computation of mass props requires gravity to be set on the object.
426 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); 429 BulletSimAPI.SetGravity2(PhysBody.ptr, grav);
427 430
428 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); 431 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
429 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); 432 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia);
430 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); 433 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
434
431 // center of mass is at the zero of the object 435 // center of mass is at the zero of the object
432 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); 436 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation);
433 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia); 437 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}", LocalID, physMass, Inertia, grav, inWorld);
434 438
435 if (inWorld) 439 if (inWorld)
436 { 440 {
437 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 441 AddObjectToPhysicalWorld();
438 } 442 }
443
444 // Must set gravity after it has been added to the world because, for unknown reasons,
445 // adding the object resets the object's gravity to world gravity
446 BulletSimAPI.SetGravity2(PhysBody.ptr, grav);
447
439 } 448 }
440 } 449 }
441 } 450 }
442 451
452 // Return what gravity should be set to this very moment
453 private OMV.Vector3 ComputeGravity()
454 {
455 OMV.Vector3 ret = PhysicsScene.DefaultGravity;
456
457 if (!IsStatic)
458 ret *= (1f - Buoyancy);
459
460 return ret;
461 }
462
443 // Is this used? 463 // Is this used?
444 public override OMV.Vector3 CenterOfMass 464 public override OMV.Vector3 CenterOfMass
445 { 465 {
@@ -665,7 +685,7 @@ public sealed class BSPrim : BSPhysObject
665 _isPhysical = value; 685 _isPhysical = value;
666 PhysicsScene.TaintedObject("BSPrim.setIsPhysical", delegate() 686 PhysicsScene.TaintedObject("BSPrim.setIsPhysical", delegate()
667 { 687 {
668 // DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical); 688 DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical);
669 SetObjectDynamic(true); 689 SetObjectDynamic(true);
670 // whether phys-to-static or static-to-phys, the object is not moving. 690 // whether phys-to-static or static-to-phys, the object is not moving.
671 ZeroMotion(true); 691 ZeroMotion(true);
@@ -720,22 +740,19 @@ public sealed class BSPrim : BSPhysObject
720 // Make solid or not (do things bounce off or pass through this object). 740 // Make solid or not (do things bounce off or pass through this object).
721 MakeSolid(IsSolid); 741 MakeSolid(IsSolid);
722 742
723 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 743 AddObjectToPhysicalWorld();
724 744
725 // Rebuild its shape 745 // Rebuild its shape
726 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 746 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
727 747
728 // Collision filter can be set only when the object is in the world
729 PhysBody.ApplyCollisionMask();
730
731 // Recompute any linkset parameters. 748 // Recompute any linkset parameters.
732 // When going from non-physical to physical, this re-enables the constraints that 749 // When going from non-physical to physical, this re-enables the constraints that
733 // had been automatically disabled when the mass was set to zero. 750 // had been automatically disabled when the mass was set to zero.
734 // For compound based linksets, this enables and disables interactions of the children. 751 // For compound based linksets, this enables and disables interactions of the children.
735 Linkset.Refresh(this); 752 Linkset.Refresh(this);
736 753
737 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", 754 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},cType={6},body={7},shape={8}",
738 LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); 755 LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody.collisionType, PhysBody, PhysShape);
739 } 756 }
740 757
741 // "Making dynamic" means changing to and from static. 758 // "Making dynamic" means changing to and from static.
@@ -876,6 +893,28 @@ public sealed class BSPrim : BSPhysObject
876 } 893 }
877 } 894 }
878 895
896 // Add me to the physical world.
897 // Object MUST NOT already be in the world.
898 // This routine exists because some assorted properties get mangled by adding to the world.
899 internal void AddObjectToPhysicalWorld()
900 {
901 if (PhysBody.HasPhysicalBody)
902 {
903 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
904
905 // TODO: Fix this. Total kludge because adding object to world resets its gravity to default.
906 // Replace this when the new AddObjectToWorld function is complete.
907 BulletSimAPI.SetGravity2(PhysBody.ptr, ComputeGravity());
908
909 // Collision filter can be set only when the object is in the world
910 if (!PhysBody.ApplyCollisionMask())
911 {
912 m_log.ErrorFormat("{0} Failed setting object collision mask: id={1}", LogHeader, LocalID);
913 DetailLog("{0},BSPrim.UpdatePhysicalParameters,failedSetMaskGroup,cType={1}", LocalID, PhysBody.collisionType);
914 }
915 }
916 }
917
879 // prims don't fly 918 // prims don't fly
880 public override bool Flying { 919 public override bool Flying {
881 get { return _flying; } 920 get { return _flying; }
@@ -891,18 +930,6 @@ public sealed class BSPrim : BSPhysObject
891 get { return _throttleUpdates; } 930 get { return _throttleUpdates; }
892 set { _throttleUpdates = value; } 931 set { _throttleUpdates = value; }
893 } 932 }
894 public override bool IsColliding {
895 get { return (CollidingStep == PhysicsScene.SimulationStep); }
896 set { _isColliding = value; }
897 }
898 public override bool CollidingGround {
899 get { return (CollidingGroundStep == PhysicsScene.SimulationStep); }
900 set { _collidingGround = value; }
901 }
902 public override bool CollidingObj {
903 get { return _collidingObj; }
904 set { _collidingObj = value; }
905 }
906 public bool IsPhantom { 933 public bool IsPhantom {
907 get { 934 get {
908 // SceneObjectPart removes phantom objects from the physics scene 935 // SceneObjectPart removes phantom objects from the physics scene
@@ -972,6 +999,7 @@ public sealed class BSPrim : BSPhysObject
972 _buoyancy = value; 999 _buoyancy = value;
973 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 1000 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
974 // Force the recalculation of the various inertia,etc variables in the object 1001 // Force the recalculation of the various inertia,etc variables in the object
1002 DetailLog("{0},BSPrim.ForceBuoyancy,buoy={1},mass={2}", LocalID, _buoyancy, _mass);
975 UpdatePhysicalMassProperties(_mass, true); 1003 UpdatePhysicalMassProperties(_mass, true);
976 ActivateIfPhysical(false); 1004 ActivateIfPhysical(false);
977 } 1005 }
@@ -981,12 +1009,12 @@ public sealed class BSPrim : BSPhysObject
981 public override OMV.Vector3 PIDTarget { 1009 public override OMV.Vector3 PIDTarget {
982 set { _PIDTarget = value; } 1010 set { _PIDTarget = value; }
983 } 1011 }
984 public override bool PIDActive {
985 set { _usePID = value; }
986 }
987 public override float PIDTau { 1012 public override float PIDTau {
988 set { _PIDTau = value; } 1013 set { _PIDTau = value; }
989 } 1014 }
1015 public override bool PIDActive {
1016 set { _usePID = value; }
1017 }
990 1018
991 // Used for llSetHoverHeight and maybe vehicle height 1019 // Used for llSetHoverHeight and maybe vehicle height
992 // Hover Height will override MoveTo target's Z 1020 // Hover Height will override MoveTo target's Z
@@ -1010,7 +1038,9 @@ public sealed class BSPrim : BSPhysObject
1010 public override float APIDDamping { set { return; } } 1038 public override float APIDDamping { set { return; } }
1011 1039
1012 public override void AddForce(OMV.Vector3 force, bool pushforce) { 1040 public override void AddForce(OMV.Vector3 force, bool pushforce) {
1013 AddForce(force, pushforce, false); 1041 // Since this force is being applied in only one step, make this a force per second.
1042 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
1043 AddForce(addForce, pushforce, false);
1014 } 1044 }
1015 // Applying a force just adds this to the total force on the object. 1045 // Applying a force just adds this to the total force on the object.
1016 // This added force will only last the next simulation tick. 1046 // This added force will only last the next simulation tick.
@@ -1018,8 +1048,16 @@ public sealed class BSPrim : BSPhysObject
1018 // for an object, doesn't matter if force is a pushforce or not 1048 // for an object, doesn't matter if force is a pushforce or not
1019 if (force.IsFinite()) 1049 if (force.IsFinite())
1020 { 1050 {
1051 float magnitude = force.Length();
1052 if (magnitude > BSParam.MaxAddForceMagnitude)
1053 {
1054 // Force has a limit
1055 force = force / magnitude * BSParam.MaxAddForceMagnitude;
1056 }
1057
1021 OMV.Vector3 addForce = force; 1058 OMV.Vector3 addForce = force;
1022 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1059 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1060
1023 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1061 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
1024 { 1062 {
1025 // Bullet adds this central force to the total force for this tick 1063 // Bullet adds this central force to the total force for this tick
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0022e45..4133107 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -38,15 +38,6 @@ using Nini.Config;
38using log4net; 38using log4net;
39using OpenMetaverse; 39using OpenMetaverse;
40 40
41// TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim)
42// Based on material, set density and friction
43// More efficient memory usage when passing hull information from BSPrim to BulletSim
44// Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect
45// Implement LockAngularMotion
46// Add PID movement operations. What does ScenePresence.MoveToTarget do?
47// Check terrain size. 128 or 127?
48// Raycast
49//
50namespace OpenSim.Region.Physics.BulletSPlugin 41namespace OpenSim.Region.Physics.BulletSPlugin
51{ 42{
52public sealed class BSScene : PhysicsScene, IPhysicsParameters 43public sealed class BSScene : PhysicsScene, IPhysicsParameters
@@ -83,6 +74,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
83 internal int m_maxSubSteps; 74 internal int m_maxSubSteps;
84 internal float m_fixedTimeStep; 75 internal float m_fixedTimeStep;
85 internal long m_simulationStep = 0; 76 internal long m_simulationStep = 0;
77 internal float NominalFrameRate { get; set; }
86 public long SimulationStep { get { return m_simulationStep; } } 78 public long SimulationStep { get { return m_simulationStep; } }
87 internal int m_taintsToProcessPerStep; 79 internal int m_taintsToProcessPerStep;
88 internal float LastTimeStep { get; private set; } 80 internal float LastTimeStep { get; private set; }
@@ -171,6 +163,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
171 private string m_physicsLoggingPrefix; 163 private string m_physicsLoggingPrefix;
172 private int m_physicsLoggingFileMinutes; 164 private int m_physicsLoggingFileMinutes;
173 private bool m_physicsLoggingDoFlush; 165 private bool m_physicsLoggingDoFlush;
166 private bool m_physicsPhysicalDumpEnabled;
174 // 'true' of the vehicle code is to log lots of details 167 // 'true' of the vehicle code is to log lots of details
175 public bool VehicleLoggingEnabled { get; private set; } 168 public bool VehicleLoggingEnabled { get; private set; }
176 public bool VehiclePhysicalLoggingEnabled { get; private set; } 169 public bool VehiclePhysicalLoggingEnabled { get; private set; }
@@ -276,11 +269,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
276 BSParam.SetParameterConfigurationValues(this, pConfig); 269 BSParam.SetParameterConfigurationValues(this, pConfig);
277 270
278 // Very detailed logging for physics debugging 271 // Very detailed logging for physics debugging
272 // TODO: the boolean values can be moved to the normal parameter processing.
279 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); 273 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
280 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); 274 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
281 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); 275 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
282 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); 276 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
283 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); 277 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
278 m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
284 // Very detailed logging for vehicle debugging 279 // Very detailed logging for vehicle debugging
285 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); 280 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
286 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); 281 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);
@@ -495,6 +490,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
495 490
496 InTaintTime = false; // Only used for debugging so locking is not necessary. 491 InTaintTime = false; // Only used for debugging so locking is not necessary.
497 492
493 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
494 // Only enable this in a limited test world with few objects.
495 if (m_physicsPhysicalDumpEnabled)
496 BulletSimAPI.DumpAllInfo2(World.ptr);
497
498 // step the physical world one interval 498 // step the physical world one interval
499 m_simulationStep++; 499 m_simulationStep++;
500 int numSubSteps = 0; 500 int numSubSteps = 0;
@@ -592,12 +592,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
592 592
593 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. 593 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
594 // Only enable this in a limited test world with few objects. 594 // Only enable this in a limited test world with few objects.
595 // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG 595 if (m_physicsPhysicalDumpEnabled)
596 BulletSimAPI.DumpAllInfo2(World.ptr);
596 597
597 // The physics engine returns the number of milliseconds it simulated this call. 598 // The physics engine returns the number of milliseconds it simulated this call.
598 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. 599 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
599 // Multiply by 55 to give a nominal frame rate of 55. 600 // Multiply by 55 to give a nominal frame rate of 55.
600 return (float)numSubSteps * m_fixedTimeStep * 1000f * 55f; 601 return (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
601 } 602 }
602 603
603 // Something has collided 604 // Something has collided
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index afe5bca..eb4d039 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -250,20 +250,20 @@ public enum CollisionFilterGroups : uint
250 // filter/mask definition below. This way collision interactions 250 // filter/mask definition below. This way collision interactions
251 // are more easily found and debugged. 251 // are more easily found and debugged.
252 BNoneGroup = 0, 252 BNoneGroup = 0,
253 BDefaultGroup = 1 << 0, 253 BDefaultGroup = 1 << 0, // 0001
254 BStaticGroup = 1 << 1, 254 BStaticGroup = 1 << 1, // 0002
255 BKinematicGroup = 1 << 2, 255 BKinematicGroup = 1 << 2, // 0004
256 BDebrisGroup = 1 << 3, 256 BDebrisGroup = 1 << 3, // 0008
257 BSensorTrigger = 1 << 4, 257 BSensorTrigger = 1 << 4, // 0010
258 BCharacterGroup = 1 << 5, 258 BCharacterGroup = 1 << 5, // 0020
259 BAllGroup = 0xFFFFFFFF, 259 BAllGroup = 0x000FFFFF,
260 // Filter groups defined by BulletSim 260 // Filter groups defined by BulletSim
261 BGroundPlaneGroup = 1 << 10, 261 BGroundPlaneGroup = 1 << 10, // 0400
262 BTerrainGroup = 1 << 11, 262 BTerrainGroup = 1 << 11, // 0800
263 BRaycastGroup = 1 << 12, 263 BRaycastGroup = 1 << 12, // 1000
264 BSolidGroup = 1 << 13, 264 BSolidGroup = 1 << 13, // 2000
265 // BLinksetGroup = xx // a linkset proper is either static or dynamic 265 // BLinksetGroup = xx // a linkset proper is either static or dynamic
266 BLinksetChildGroup = 1 << 14, 266 BLinksetChildGroup = 1 << 14, // 4000
267}; 267};
268 268
269// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 269// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index 36d38d4..5ad6746 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -72,12 +72,12 @@ public struct BulletBody
72 public bool HasPhysicalBody { get { return ptr != IntPtr.Zero; } } 72 public bool HasPhysicalBody { get { return ptr != IntPtr.Zero; } }
73 73
74 // Apply the specificed collision mask into the physical world 74 // Apply the specificed collision mask into the physical world
75 public void ApplyCollisionMask() 75 public bool ApplyCollisionMask()
76 { 76 {
77 // Should assert the body has been added to the physical world. 77 // Should assert the body has been added to the physical world.
78 // (The collision masks are stored in the collision proxy cache which only exists for 78 // (The collision masks are stored in the collision proxy cache which only exists for
79 // a collision body that is in the world.) 79 // a collision body that is in the world.)
80 BulletSimAPI.SetCollisionGroupMask2(ptr, 80 return BulletSimAPI.SetCollisionGroupMask2(ptr,
81 BulletSimData.CollisionTypeMasks[collisionType].group, 81 BulletSimData.CollisionTypeMasks[collisionType].group,
82 BulletSimData.CollisionTypeMasks[collisionType].mask); 82 BulletSimData.CollisionTypeMasks[collisionType].mask);
83 } 83 }
@@ -207,26 +207,6 @@ public struct CollisionTypeFilterGroup
207 public uint mask; 207 public uint mask;
208}; 208};
209 209
210 /* NOTE: old definitions kept for reference. Delete when things are working.
211 // The collsion filters and masked are defined in one place -- don't want them scattered
212 AvatarGroup = BCharacterGroup,
213 AvatarMask = BAllGroup,
214 ObjectGroup = BSolidGroup,
215 ObjectMask = BAllGroup,
216 StaticObjectGroup = BStaticGroup,
217 StaticObjectMask = AvatarGroup | ObjectGroup, // static things don't interact with much
218 LinksetGroup = BLinksetGroup,
219 LinksetMask = BAllGroup,
220 LinksetChildGroup = BLinksetChildGroup,
221 LinksetChildMask = BNoneGroup, // Linkset children disappear from the world
222 VolumeDetectGroup = BSensorTrigger,
223 VolumeDetectMask = ~BSensorTrigger,
224 TerrainGroup = BTerrainGroup,
225 TerrainMask = BAllGroup & ~BStaticGroup, // static objects on the ground don't collide
226 GroundPlaneGroup = BGroundPlaneGroup,
227 GroundPlaneMask = BAllGroup
228 */
229
230public static class BulletSimData 210public static class BulletSimData
231{ 211{
232 212
@@ -269,8 +249,9 @@ public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeM
269 }, 249 },
270 { CollisionType.LinksetChild, 250 { CollisionType.LinksetChild,
271 new CollisionTypeFilterGroup(CollisionType.LinksetChild, 251 new CollisionTypeFilterGroup(CollisionType.LinksetChild,
272 (uint)CollisionFilterGroups.BTerrainGroup, 252 (uint)CollisionFilterGroups.BLinksetChildGroup,
273 (uint)(CollisionFilterGroups.BNoneGroup)) 253 (uint)(CollisionFilterGroups.BNoneGroup))
254 // (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup))
274 }, 255 },
275}; 256};
276 257
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 35cb8f3..f805836 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,22 +1,22 @@
1CURRENT PRIORITIES 1CURRENT PRIORITIES
2================================================= 2=================================================
3Smooth avatar movement with motor (DONE) 3Redo BulletSimAPI to allow native C# implementation of Bullet option.
4 Should motor update be all at taint-time? (Yes, DONE) 4Avatar movement
5 Fix avatar slowly sliding when standing (zero motion when stopped) 5 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle
6llApplyImpulse() 6 walking up stairs is not calibrated correctly (stairs out of Kepler cabin)
7 Compare mass/movement in OS and SL. Calibrate actions. 7 avatar capsule rotation completed
8llSetBuoyancy() 8llMoveToTarget
9Boats float low in the water
10Enable vehicle border crossings (at least as poorly as ODE) 9Enable vehicle border crossings (at least as poorly as ODE)
11 Terrain skirts 10 Terrain skirts
12 Avatar created in previous region and not new region when crossing border 11 Avatar created in previous region and not new region when crossing border
13 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) 12 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
14Add material densities to the material types.
15Vehicle movement on terrain smoothness 13Vehicle movement on terrain smoothness
16Vehicle script tuning/debugging 14Vehicle script tuning/debugging
17 Avanti speed script 15 Avanti speed script
18 Weapon shooter script 16 Weapon shooter script
19limitMotorUp calibration (more down?) 17limitMotorUp calibration (more down?)
18Boats float low in the water
19Add material densities to the material types.
20 20
21CRASHES 21CRASHES
22================================================= 22=================================================
@@ -35,6 +35,8 @@ Border crossing with linked vehicle causes crash
35Vehicles (Move smoothly) 35Vehicles (Move smoothly)
36Add vehicle collisions so IsColliding is properly reported. 36Add vehicle collisions so IsColliding is properly reported.
37 Needed for banking, limitMotorUp, movementLimiting, ... 37 Needed for banking, limitMotorUp, movementLimiting, ...
38VehicleAddForce is not scaled by the simulation step but it is only
39 applied for one step. Should it be scaled?
38Some vehicles should not be able to turn if no speed or off ground. 40Some vehicles should not be able to turn if no speed or off ground.
39Cannot edit/move a vehicle being ridden: it jumps back to the origional position. 41Cannot edit/move a vehicle being ridden: it jumps back to the origional position.
40Neb car jiggling left and right 42Neb car jiggling left and right
@@ -58,7 +60,6 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
58 60
59BULLETSIM TODO LIST: 61BULLETSIM TODO LIST:
60================================================= 62=================================================
61In SL, perfect spheres don't seem to have rolling friction. Add special case.
62Avatar density is WAY off. Compare and calibrate with what's in SL. 63Avatar density is WAY off. Compare and calibrate with what's in SL.
63Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. 64Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
64Duplicating a physical prim causes old prim to jump away 65Duplicating a physical prim causes old prim to jump away
@@ -93,6 +94,9 @@ Should the different PID factors have non-equal contributions for different
93Selecting and deselecting physical objects causes CPU processing time to jump 94Selecting and deselecting physical objects causes CPU processing time to jump
94 http://www.youtube.com/watch?v=Hjg57fWg8yI&hd=1 95 http://www.youtube.com/watch?v=Hjg57fWg8yI&hd=1
95 put thousand physical objects, select and deselect same. CPU time will be large. 96 put thousand physical objects, select and deselect same. CPU time will be large.
97Re-implement buoyancy as a separate force on the object rather than diddling gravity.
98 Register a pre-step event to add the force.
99More efficient memory usage when passing hull information from BSPrim to BulletSim
96 100
97LINKSETS 101LINKSETS
98====================================================== 102======================================================
@@ -146,6 +150,8 @@ Is there are more efficient method of implementing pre and post step actions?
146 See http://www.codeproject.com/Articles/29922/Weak-Events-in-C 150 See http://www.codeproject.com/Articles/29922/Weak-Events-in-C
147 151
148Physics Arena central pyramid: why is one side permiable? 152Physics Arena central pyramid: why is one side permiable?
153
154In SL, perfect spheres don't seem to have rolling friction. Add special case.
149Enforce physical parameter min/max: 155Enforce physical parameter min/max:
150 Gravity: [-1, 28] 156 Gravity: [-1, 28]
151 Friction: [0, 255] 157 Friction: [0, 255]
@@ -188,6 +194,7 @@ Should taints check for existance or activeness of target?
188 actually gone when the taint happens. Crashes don't happen because the taint closure 194 actually gone when the taint happens. Crashes don't happen because the taint closure
189 keeps the object from being freed, but that is just an accident. 195 keeps the object from being freed, but that is just an accident.
190 Possibly have and 'active' flag that is checked by the taint processor? 196 Possibly have and 'active' flag that is checked by the taint processor?
197Parameters for physics logging should be moved from BSScene to BSParam (at least boolean ones)
191 198
192THREADING 199THREADING
193================================================= 200=================================================
@@ -237,3 +244,12 @@ Should vehicle angular/linear movement friction happen after all the components
237 What is expected by some vehicles (turning up friction to moderate speed)) 244 What is expected by some vehicles (turning up friction to moderate speed))
238Tune terrain/object friction to be closer to SL. 245Tune terrain/object friction to be closer to SL.
239 (Resolution: added material type with friction and resolution) 246 (Resolution: added material type with friction and resolution)
247Smooth avatar movement with motor (DONE)
248 Should motor update be all at taint-time? (Yes, DONE)
249 Fix avatar slowly sliding when standing (zero motion when stopped) (DONE)
250 (Resolution: added BSVMotor for avatar starting and stopping)
251llApplyImpulse()
252 Compare mass/movement in OS and SL. Calibrate actions. (DONE)
253 (Resolution: tested on SL and OS. AddForce scales the force for timestep)
254llSetBuoyancy() (DONE)
255 (Resolution: Bullet resets object gravity when added to world. Moved set gravity)