aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
diff options
context:
space:
mode:
authorRobert Adams2016-11-13 11:19:54 -0800
committerRobert Adams2016-11-13 11:19:54 -0800
commite13ff5a39233fd871e69f9ace23b4559cdfdcb7f (patch)
treea5e56577bb153a7dd481ee13571fabeb3e716b35 /OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
parentmantis 8055: fix default value of npc options (diff)
downloadopensim-SC_OLD-e13ff5a39233fd871e69f9ace23b4559cdfdcb7f.zip
opensim-SC_OLD-e13ff5a39233fd871e69f9ace23b4559cdfdcb7f.tar.gz
opensim-SC_OLD-e13ff5a39233fd871e69f9ace23b4559cdfdcb7f.tar.bz2
opensim-SC_OLD-e13ff5a39233fd871e69f9ace23b4559cdfdcb7f.tar.xz
BulletSim: update avatar velocity setting to the new TargetVelocity pattern.
Now PhysicsActor.Velocity.set and PhysicsActor.SetMomentum do the same thing of setting the instantanious avatar velocity. PhysicsActor.TargetVelocity sets a velocity target and the movement motor is used to accelerate the' avatar to that velocity.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs')
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs34
1 files changed, 26 insertions, 8 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index 3682455..a846869 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
@@ -230,15 +230,22 @@ public abstract class BSPhysObject : PhysicsActor
230 // Update the physical location and motion of the object. Called with data from Bullet. 230 // Update the physical location and motion of the object. Called with data from Bullet.
231 public abstract void UpdateProperties(EntityProperties entprop); 231 public abstract void UpdateProperties(EntityProperties entprop);
232 232
233 // The position value as known by BulletSim. Does not effect the physics engine.
233 public virtual OMV.Vector3 RawPosition { get; set; } 234 public virtual OMV.Vector3 RawPosition { get; set; }
235 // Set position in BulletSim and the physics engined to a value immediately. Must be called at taint time.
234 public abstract OMV.Vector3 ForcePosition { get; set; } 236 public abstract OMV.Vector3 ForcePosition { get; set; }
235 237
238 // The orientation value as known by BulletSim. Does not effect the physics engine.
236 public virtual OMV.Quaternion RawOrientation { get; set; } 239 public virtual OMV.Quaternion RawOrientation { get; set; }
240 // Set orientation in BulletSim and the physics engine to a value immediately. Must be called at taint time.
237 public abstract OMV.Quaternion ForceOrientation { get; set; } 241 public abstract OMV.Quaternion ForceOrientation { get; set; }
238 242
243 // The velocity value as known by BulletSim. Does not effect the physics engine.
239 public virtual OMV.Vector3 RawVelocity { get; set; } 244 public virtual OMV.Vector3 RawVelocity { get; set; }
245 // Set velocity in BulletSim and the physics engined to a value immediately. Must be called at taint time.
240 public abstract OMV.Vector3 ForceVelocity { get; set; } 246 public abstract OMV.Vector3 ForceVelocity { get; set; }
241 247
248 // The rotational velocity value as known by BulletSim. Does not effect the physics engine.
242 public OMV.Vector3 RawRotationalVelocity { get; set; } 249 public OMV.Vector3 RawRotationalVelocity { get; set; }
243 250
244 // RawForce is a constant force applied to object (see Force { set; } ) 251 // RawForce is a constant force applied to object (see Force { set; } )
@@ -252,17 +259,28 @@ public abstract class BSPhysObject : PhysicsActor
252 public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); 259 public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force);
253 public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); 260 public abstract void AddForce(bool inTaintTime, OMV.Vector3 force);
254 261
262 // PhysicsActor.Velocity
263 public override OMV.Vector3 Velocity
264 {
265 get { return RawVelocity; }
266 set
267 {
268 // This sets the velocity now. BSCharacter will override to clear target velocity
269 // before calling this.
270 RawVelocity = value;
271 PhysScene.TaintedObject(LocalID, TypeName + ".SetVelocity", delegate () {
272 // DetailLog("{0},BSPhysObject.Velocity.set,vel={1}", LocalID, RawVelocity);
273 ForceVelocity = RawVelocity;
274 });
275 }
276 }
277
255 // PhysicsActor.SetMomentum 278 // PhysicsActor.SetMomentum
256 // All the physics engined use this as a way of forcing the velocity to something. 279 // All the physics engines use this as a way of forcing the velocity to something.
280 // BSCharacter overrides this so it can set the target velocity to zero before calling this.
257 public override void SetMomentum(OMV.Vector3 momentum) 281 public override void SetMomentum(OMV.Vector3 momentum)
258 { 282 {
259 // This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor) 283 this.Velocity = momentum;
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 } 284 }
267 285
268 public override OMV.Vector3 RotationalVelocity { 286 public override OMV.Vector3 RotationalVelocity {