diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index bb21f0c..3682455 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 | ||
@@ -582,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
582 | { | 625 | { |
583 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 626 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
584 | DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", | 627 | DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", |
585 | LocalID, TypeName, ms, CurrentCollisionFlags); | 628 | LocalID, TypeName, SubscribedEventsMs, CurrentCollisionFlags); |
586 | } | 629 | } |
587 | }); | 630 | }); |
588 | } | 631 | } |