aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
diff options
context:
space:
mode:
authorRobert Adams2016-09-30 19:35:44 -0700
committerRobert Adams2016-09-30 19:35:44 -0700
commitc7e4b14a26c2c3a265b268a9e6c43e6c93db205e (patch)
tree7e0b9878a9acab973443b633b4c61b9343f844b3 /OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
parentMySQLFSAssetData asset type is a int not a varchar (diff)
downloadopensim-SC_OLD-c7e4b14a26c2c3a265b268a9e6c43e6c93db205e.zip
opensim-SC_OLD-c7e4b14a26c2c3a265b268a9e6c43e6c93db205e.tar.gz
opensim-SC_OLD-c7e4b14a26c2c3a265b268a9e6c43e6c93db205e.tar.bz2
opensim-SC_OLD-c7e4b14a26c2c3a265b268a9e6c43e6c93db205e.tar.xz
BulletSim: fix problem with avatar velocity going to zero when flying across
region boundries. Move code for Velocity, ForceVelocity and SetMomentum to BSPhysObject and have both BSPrim and BSCharacter share the code.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs')
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs45
1 files changed, 44 insertions, 1 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index bb21f0c..7c6f213 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
@@ -239,6 +239,8 @@ public abstract class BSPhysObject : PhysicsActor
239 public virtual OMV.Vector3 RawVelocity { get; set; } 239 public virtual OMV.Vector3 RawVelocity { get; set; }
240 public abstract OMV.Vector3 ForceVelocity { get; set; } 240 public abstract OMV.Vector3 ForceVelocity { get; set; }
241 241
242 public OMV.Vector3 RawRotationalVelocity { get; set; }
243
242 // RawForce is a constant force applied to object (see Force { set; } ) 244 // RawForce is a constant force applied to object (see Force { set; } )
243 public OMV.Vector3 RawForce { get; set; } 245 public OMV.Vector3 RawForce { get; set; }
244 public OMV.Vector3 RawTorque { get; set; } 246 public OMV.Vector3 RawTorque { get; set; }
@@ -250,7 +252,48 @@ public abstract class BSPhysObject : PhysicsActor
250 public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); 252 public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force);
251 public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); 253 public abstract void AddForce(bool inTaintTime, OMV.Vector3 force);
252 254
253 public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } 255 // PhysicsActor.SetMomentum
256 // All the physics engined use this as a way of forcing the velocity to something.
257 public override void SetMomentum(OMV.Vector3 momentum)
258 {
259 // This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor)
260 RawVelocity = momentum;
261 PhysScene.TaintedObject(LocalID, TypeName + ".SetMomentum", delegate()
262 {
263 // DetailLog("{0},BSPrim.SetMomentum,taint,vel={1}", LocalID, RawVelocity);
264 ForceVelocity = RawVelocity;
265 });
266 }
267
268 public override OMV.Vector3 RotationalVelocity {
269 get {
270 return RawRotationalVelocity;
271 }
272 set {
273 RawRotationalVelocity = value;
274 Util.ClampV(RawRotationalVelocity, BSParam.MaxAngularVelocity);
275 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
276 PhysScene.TaintedObject(LocalID, TypeName + ".setRotationalVelocity", delegate()
277 {
278 ForceRotationalVelocity = RawRotationalVelocity;
279 });
280 }
281 }
282 public OMV.Vector3 ForceRotationalVelocity {
283 get {
284 return RawRotationalVelocity;
285 }
286 set {
287 RawRotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity);
288 if (PhysBody.HasPhysicalBody)
289 {
290 DetailLog("{0},{1}.ForceRotationalVel,taint,rotvel={2}", LocalID, TypeName, RawRotationalVelocity);
291 PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity);
292 // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
293 ActivateIfPhysical(false);
294 }
295 }
296 }
254 297
255 public abstract float ForceBuoyancy { get; set; } 298 public abstract float ForceBuoyancy { get; set; }
256 299