diff options
author | Robert Adams | 2012-11-06 17:58:55 -0800 |
---|---|---|
committer | Robert Adams | 2012-11-06 18:16:35 -0800 |
commit | 76cc3030314b3302da46bfe4078f076ba1b3d8a1 (patch) | |
tree | defc41af21d4542789c00a93452d5793ec7f896d /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |
parent | BulletSim: remove limit on taints that can happen before a step. Remove some ... (diff) | |
download | opensim-SC_OLD-76cc3030314b3302da46bfe4078f076ba1b3d8a1.zip opensim-SC_OLD-76cc3030314b3302da46bfe4078f076ba1b3d8a1.tar.gz opensim-SC_OLD-76cc3030314b3302da46bfe4078f076ba1b3d8a1.tar.bz2 opensim-SC_OLD-76cc3030314b3302da46bfe4078f076ba1b3d8a1.tar.xz |
BulletSim: Add ZeroAngularMotion method to physical objects. Add inTaint flag to ZeroMotion method. Update the references to those functions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 27 |
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 | ||