aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs63
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt20
2 files changed, 33 insertions, 50 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 1904ddd..94b63e5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1010,69 +1010,48 @@ public sealed class BSPrim : BSPhysObject
1010 set { 1010 set {
1011 if (value) 1011 if (value)
1012 { 1012 {
1013 // Turning the target on 1013 // We're taking over after this.
1014 /* 1014 ZeroMotion(true);
1015
1015 _targetMotor = new BSVMotor("BSPrim.PIDTarget", 1016 _targetMotor = new BSVMotor("BSPrim.PIDTarget",
1016 _PIDTau, // timeScale 1017 _PIDTau, // timeScale
1017 BSMotor.Infinite, // decay time scale 1018 BSMotor.Infinite, // decay time scale
1018 BSMotor.InfiniteVector, // friction timescale 1019 BSMotor.InfiniteVector, // friction timescale
1019 1f // efficiency 1020 1f // efficiency
1020 ); 1021 );
1022 _targetMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages.
1021 _targetMotor.SetTarget(_PIDTarget); 1023 _targetMotor.SetTarget(_PIDTarget);
1022 _targetMotor.SetCurrent(RawPosition); 1024 _targetMotor.SetCurrent(RawPosition);
1023 */ 1025 /*
1024 _targetMotor = new BSPIDVMotor("BSPrim.PIDTarget"); 1026 _targetMotor = new BSPIDVMotor("BSPrim.PIDTarget");
1027 _targetMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages.
1028
1025 _targetMotor.SetTarget(_PIDTarget); 1029 _targetMotor.SetTarget(_PIDTarget);
1026 _targetMotor.SetCurrent(RawPosition); 1030 _targetMotor.SetCurrent(RawPosition);
1031 _targetMotor.TimeScale = _PIDTau;
1027 _targetMotor.Efficiency = 1f; 1032 _targetMotor.Efficiency = 1f;
1028 1033 */
1029 _targetMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages.
1030 1034
1031 RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) 1035 RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep)
1032 { 1036 {
1033 // How far are we away from the target 1037 OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below)
1034 OMV.Vector3 distance = _PIDTarget - RawPosition;
1035
1036 // The amount of that distance we should cover per second
1037 OMV.Vector3 movementPerSecond = distance / _PIDTau;
1038
1039 OMV.Vector3 adjustedVelocity = movementPerSecond - RawVelocity;
1040
1041 // Apply force to overcome current velocity
1042 AddForce(-RawVelocity * Mass, false, true);
1043 // Get it moving to the point
1044 AddForce(movementPerSecond * Mass, false, true);
1045
1046 // Apply enough force to get to the speed needed to get to the point
1047 // The physics engine will do only a timestep's worth.
1048 // AddForce(adjustedVelocity * Mass, false, true);
1049 // PhysicsScene.PE.ApplyCentralImpulse(PhysBody, adjustedVelocity);
1050
1051 DetailLog("{0},BSPrim.PIDTarget,move,tgt={1},pos={2},vel={3},dist={4},tau={5},mvmt={6},newVel={7}",
1052 LocalID, _PIDTarget, RawPosition, RawVelocity, distance, _PIDTau, movementPerSecond, adjustedVelocity);
1053
1054 /*
1055 OMV.Vector3 movePosition = _targetMotor.Step(timeStep);
1056 1038
1057 // 'movePosition' is where we'd like the prim to be at this moment. 1039 // 'movePosition' is where we'd like the prim to be at this moment.
1058 // Compute the amount of force to push us there. 1040 OMV.Vector3 movePosition = _targetMotor.Step(timeStep);
1059 OMV.Vector3 moveForce = (movePosition - RawPosition) * Mass;
1060 1041
1061 // If we are very close to our target, turn off the movement motor. 1042 // If we are very close to our target, turn off the movement motor.
1062 if (_targetMotor.ErrorIsZero()) 1043 if (_targetMotor.ErrorIsZero())
1063 { 1044 {
1064 DetailLog("{0},BSPrim.PIDTarget,zeroMovement,movePos={1},pos={2},mass={3},moveForce={4}", 1045 DetailLog("{0},BSPrim.PIDTarget,zeroMovement,movePos={1},pos={2},mass={3}",
1065 LocalID, movePosition, RawPosition, Mass, moveForce); 1046 LocalID, movePosition, RawPosition, Mass);
1066 moveForce = OMV.Vector3.Zero;
1067 ForcePosition = _targetMotor.TargetValue; 1047 ForcePosition = _targetMotor.TargetValue;
1068 _targetMotor.Enabled = false; 1048 _targetMotor.Enabled = false;
1069 } 1049 }
1070 else 1050 else
1071 { 1051 {
1072 AddForce(moveForce, false, true); 1052 ForcePosition = movePosition;
1073 } 1053 }
1074 DetailLog("{0},BSPrim.PIDTarget,move,movePos={1},moveForce={2},mass={3}", LocalID, movePosition, moveForce, Mass); 1054 DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition);
1075 */
1076 }); 1055 });
1077 } 1056 }
1078 else 1057 else
@@ -1102,17 +1081,17 @@ public sealed class BSPrim : BSPhysObject
1102 1081
1103 RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) 1082 RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep)
1104 { 1083 {
1105 // TODO: Decide if the step parameters should be changed depending on the avatar's 1084 _hoverMotor.SetCurrent(RawPosition.Z);
1106 // state (flying, colliding, ...). There is code in ODE to do this.
1107
1108 _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); 1085 _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight());
1109 float targetHeight = _hoverMotor.Step(timeStep); 1086 float targetHeight = _hoverMotor.Step(timeStep);
1110 1087
1111 // 'targetHeight' is where we'd like the Z of the prim to be at this moment. 1088 // 'targetHeight' is where we'd like the Z of the prim to be at this moment.
1112 // Compute the amount of force to push us there. 1089 // Compute the amount of force to push us there.
1113 float moveForce = (targetHeight - RawPosition.Z) * Mass / PhysicsScene.LastTimeStep; 1090 float moveForce = (targetHeight - RawPosition.Z) * Mass;
1091 // Undo anything the object thinks it's doing at the moment
1092 moveForce = -RawVelocity.Z * Mass;
1114 1093
1115 AddForce(new OMV.Vector3(0f, 0f, moveForce), false, true); 1094 PhysicsScene.PE.ApplyCentralImpulse(PhysBody, new OMV.Vector3(0f, 0f, moveForce));
1116 DetailLog("{0},BSPrim.Hover,move,targHt={1},moveForce={2},mass={3}", LocalID, targetHeight, moveForce, Mass); 1095 DetailLog("{0},BSPrim.Hover,move,targHt={1},moveForce={2},mass={3}", LocalID, targetHeight, moveForce, Mass);
1117 }); 1096 });
1118 } 1097 }
@@ -1174,7 +1153,7 @@ public sealed class BSPrim : BSPhysObject
1174 // This added force will only last the next simulation tick. 1153 // This added force will only last the next simulation tick.
1175 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 1154 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
1176 // for an object, doesn't matter if force is a pushforce or not 1155 // for an object, doesn't matter if force is a pushforce or not
1177 if (force.IsFinite()) 1156 if (!IsStatic && force.IsFinite())
1178 { 1157 {
1179 float magnitude = force.Length(); 1158 float magnitude = force.Length();
1180 if (magnitude > BSParam.MaxAddForceMagnitude) 1159 if (magnitude > BSParam.MaxAddForceMagnitude)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index a8a4ff5..facf720 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,22 +1,26 @@
1CURRENT PRIORITIES 1CURRENT PRIORITIES
2================================================= 2=================================================
3Redo BulletSimAPI to allow native C# implementation of Bullet option. 3Redo BulletSimAPI to allow native C# implementation of Bullet option (DONE)
4Meshes rendering as bounding boxes
5llMoveToTarget
6Vehicle movement on terrain smoothness
7limitMotorUp calibration (more down?)
8Preferred orientatino angular correction fix
9Surfboard go wonky when turning
10 Angular motor direction is global coordinates rather than local coordinates?
11Boats float low in the water
4Avatar movement 12Avatar movement
5 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle 13 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
6 walking up stairs is not calibrated correctly (stairs out of Kepler cabin) 14 walking up stairs is not calibrated correctly (stairs out of Kepler cabin)
7 avatar capsule rotation completed 15 avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution)
8llMoveToTarget
9Enable vehicle border crossings (at least as poorly as ODE) 16Enable vehicle border crossings (at least as poorly as ODE)
10 Terrain skirts 17 Terrain skirts
11 Avatar created in previous region and not new region when crossing border 18 Avatar created in previous region and not new region when crossing border
12 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) 19 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
13Vehicle movement on terrain smoothness
14Vehicle script tuning/debugging 20Vehicle script tuning/debugging
15 Avanti speed script 21 Avanti speed script
16 Weapon shooter script 22 Weapon shooter script
17limitMotorUp calibration (more down?) 23Add material densities to the material types
18Boats float low in the water
19Add material densities to the material types.
20 24
21CRASHES 25CRASHES
22================================================= 26=================================================