aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs27
1 files changed, 20 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 2a5397e..f33c124 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -103,7 +103,7 @@ public sealed class BSCharacter : BSPhysObject
103 PhysicsScene.TaintedObject("BSCharacter.create", delegate() 103 PhysicsScene.TaintedObject("BSCharacter.create", delegate()
104 { 104 {
105 DetailLog("{0},BSCharacter.create,taint", LocalID); 105 DetailLog("{0},BSCharacter.create,taint", LocalID);
106 // New body and shape into BSBody and BSShape 106 // New body and shape into PhysBody and PhysShape
107 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); 107 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null);
108 108
109 SetPhysicalProperties(); 109 SetPhysicalProperties();
@@ -126,7 +126,7 @@ public sealed class BSCharacter : BSPhysObject
126 { 126 {
127 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 127 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
128 128
129 ZeroMotion(); 129 ZeroMotion(true);
130 ForcePosition = _position; 130 ForcePosition = _position;
131 // Set the velocity and compute the proper friction 131 // Set the velocity and compute the proper friction
132 ForceVelocity = _velocity; 132 ForceVelocity = _velocity;
@@ -218,18 +218,31 @@ public sealed class BSCharacter : BSPhysObject
218 // Do it to the properties so the values get set in the physics engine. 218 // Do it to the properties so the values get set in the physics engine.
219 // Push the setting of the values to the viewer. 219 // Push the setting of the values to the viewer.
220 // Called at taint time! 220 // Called at taint time!
221 public override void ZeroMotion() 221 public override void ZeroMotion(bool inTaintTime)
222 { 222 {
223 _velocity = OMV.Vector3.Zero; 223 _velocity = OMV.Vector3.Zero;
224 _acceleration = OMV.Vector3.Zero; 224 _acceleration = OMV.Vector3.Zero;
225 _rotationalVelocity = OMV.Vector3.Zero; 225 _rotationalVelocity = OMV.Vector3.Zero;
226 226
227 // Zero some other properties directly into the physics engine 227 // Zero some other properties directly into the physics engine
228 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 228 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
229 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 229 {
230 BulletSimAPI.SetInterpolationVelocity2(PhysBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); 230 BulletSimAPI.ClearAllForces2(PhysBody.ptr);
231 BulletSimAPI.ClearForces2(PhysBody.ptr); 231 });
232 } 232 }
233 public override void ZeroAngularMotion(bool inTaintTime)
234 {
235 _rotationalVelocity = OMV.Vector3.Zero;
236
237 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
238 {
239 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
240 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
241 // The next also get rid of applied linear force but the linear velocity is untouched.
242 BulletSimAPI.ClearForces2(PhysBody.ptr);
243 });
244 }
245
233 246
234 public override void LockAngularMotion(OMV.Vector3 axis) { return; } 247 public override void LockAngularMotion(OMV.Vector3 axis) { return; }
235 248