aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs78
1 files changed, 39 insertions, 39 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index b9013ab..8c7061d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -131,45 +131,45 @@ public sealed class BSCharacter : BSPhysObject
131 DetailLog("{0},BSCharacter.Destroy", LocalID); 131 DetailLog("{0},BSCharacter.Destroy", LocalID);
132 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() 132 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate()
133 { 133 {
134 PhysicsScene.Shapes.DereferenceBody(BSBody, true, null); 134 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null);
135 PhysicsScene.Shapes.DereferenceShape(BSShape, true, null); 135 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null);
136 }); 136 });
137 } 137 }
138 138
139 private void SetPhysicalProperties() 139 private void SetPhysicalProperties()
140 { 140 {
141 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, BSBody.ptr); 141 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
142 142
143 ZeroMotion(); 143 ZeroMotion();
144 ForcePosition = _position; 144 ForcePosition = _position;
145 // Set the velocity and compute the proper friction 145 // Set the velocity and compute the proper friction
146 ForceVelocity = _velocity; 146 ForceVelocity = _velocity;
147 147
148 BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); 148 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.avatarRestitution);
149 BulletSimAPI.SetMargin2(BSShape.ptr, PhysicsScene.Params.collisionMargin); 149 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin);
150 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 150 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
151 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 151 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
152 if (PhysicsScene.Params.ccdMotionThreshold > 0f) 152 if (PhysicsScene.Params.ccdMotionThreshold > 0f)
153 { 153 {
154 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); 154 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold);
155 BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); 155 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius);
156 } 156 }
157 157
158 UpdatePhysicalMassProperties(MassRaw); 158 UpdatePhysicalMassProperties(MassRaw);
159 159
160 // Make so capsule does not fall over 160 // Make so capsule does not fall over
161 BulletSimAPI.SetAngularFactorV2(BSBody.ptr, OMV.Vector3.Zero); 161 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
162 162
163 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 163 BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT);
164 164
165 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); 165 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
166 166
167 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 167 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG);
168 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION); 168 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_DEACTIVATION);
169 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); 169 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
170 170
171 // Do this after the object has been added to the world 171 // Do this after the object has been added to the world
172 BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, 172 BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr,
173 (uint)CollisionFilterGroups.AvatarFilter, 173 (uint)CollisionFilterGroups.AvatarFilter,
174 (uint)CollisionFilterGroups.AvatarMask); 174 (uint)CollisionFilterGroups.AvatarMask);
175 } 175 }
@@ -199,7 +199,7 @@ public sealed class BSCharacter : BSPhysObject
199 199
200 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 200 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
201 { 201 {
202 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 202 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
203 UpdatePhysicalMassProperties(MassRaw); 203 UpdatePhysicalMassProperties(MassRaw);
204 }); 204 });
205 205
@@ -234,10 +234,10 @@ public sealed class BSCharacter : BSPhysObject
234 _rotationalVelocity = OMV.Vector3.Zero; 234 _rotationalVelocity = OMV.Vector3.Zero;
235 235
236 // Zero some other properties directly into the physics engine 236 // Zero some other properties directly into the physics engine
237 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, OMV.Vector3.Zero); 237 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
238 BulletSimAPI.SetAngularVelocity2(BSBody.ptr, OMV.Vector3.Zero); 238 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
239 BulletSimAPI.SetInterpolationVelocity2(BSBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); 239 BulletSimAPI.SetInterpolationVelocity2(PhysBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero);
240 BulletSimAPI.ClearForces2(BSBody.ptr); 240 BulletSimAPI.ClearForces2(PhysBody.ptr);
241 } 241 }
242 242
243 public override void LockAngularMotion(OMV.Vector3 axis) { return; } 243 public override void LockAngularMotion(OMV.Vector3 axis) { return; }
@@ -254,19 +254,19 @@ public sealed class BSCharacter : BSPhysObject
254 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() 254 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate()
255 { 255 {
256 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 256 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
257 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 257 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
258 }); 258 });
259 } 259 }
260 } 260 }
261 public override OMV.Vector3 ForcePosition { 261 public override OMV.Vector3 ForcePosition {
262 get { 262 get {
263 _position = BulletSimAPI.GetPosition2(BSBody.ptr); 263 _position = BulletSimAPI.GetPosition2(PhysBody.ptr);
264 return _position; 264 return _position;
265 } 265 }
266 set { 266 set {
267 _position = value; 267 _position = value;
268 PositionSanityCheck(); 268 PositionSanityCheck();
269 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 269 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
270 } 270 }
271 } 271 }
272 272
@@ -313,7 +313,7 @@ public sealed class BSCharacter : BSPhysObject
313 BSScene.TaintCallback sanityOperation = delegate() 313 BSScene.TaintCallback sanityOperation = delegate()
314 { 314 {
315 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 315 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
316 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 316 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
317 }; 317 };
318 if (inTaintTime) 318 if (inTaintTime)
319 sanityOperation(); 319 sanityOperation();
@@ -332,8 +332,8 @@ public sealed class BSCharacter : BSPhysObject
332 } 332 }
333 public override void UpdatePhysicalMassProperties(float physMass) 333 public override void UpdatePhysicalMassProperties(float physMass)
334 { 334 {
335 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, physMass); 335 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
336 BulletSimAPI.SetMassProps2(BSBody.ptr, physMass, localInertia); 336 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia);
337 } 337 }
338 338
339 public override OMV.Vector3 Force { 339 public override OMV.Vector3 Force {
@@ -344,7 +344,7 @@ public sealed class BSCharacter : BSPhysObject
344 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() 344 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate()
345 { 345 {
346 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); 346 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force);
347 BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); 347 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
348 }); 348 });
349 } 349 }
350 } 350 }
@@ -383,7 +383,7 @@ public sealed class BSCharacter : BSPhysObject
383 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction) 383 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction)
384 { 384 {
385 _currentFriction = PhysicsScene.Params.avatarStandingFriction; 385 _currentFriction = PhysicsScene.Params.avatarStandingFriction;
386 BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); 386 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
387 } 387 }
388 } 388 }
389 else 389 else
@@ -391,15 +391,15 @@ public sealed class BSCharacter : BSPhysObject
391 if (_currentFriction != PhysicsScene.Params.avatarFriction) 391 if (_currentFriction != PhysicsScene.Params.avatarFriction)
392 { 392 {
393 _currentFriction = PhysicsScene.Params.avatarFriction; 393 _currentFriction = PhysicsScene.Params.avatarFriction;
394 BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); 394 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
395 } 395 }
396 } 396 }
397 _velocity = value; 397 _velocity = value;
398 // Remember the set velocity so we can suppress the reduction by friction, ... 398 // Remember the set velocity so we can suppress the reduction by friction, ...
399 _appliedVelocity = value; 399 _appliedVelocity = value;
400 400
401 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); 401 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
402 BulletSimAPI.Activate2(BSBody.ptr, true); 402 BulletSimAPI.Activate2(PhysBody.ptr, true);
403 } 403 }
404 } 404 }
405 public override OMV.Vector3 Torque { 405 public override OMV.Vector3 Torque {
@@ -424,7 +424,7 @@ public sealed class BSCharacter : BSPhysObject
424 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() 424 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate()
425 { 425 {
426 // _position = BulletSimAPI.GetPosition2(BSBody.ptr); 426 // _position = BulletSimAPI.GetPosition2(BSBody.ptr);
427 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 427 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
428 }); 428 });
429 } 429 }
430 } 430 }
@@ -433,13 +433,13 @@ public sealed class BSCharacter : BSPhysObject
433 { 433 {
434 get 434 get
435 { 435 {
436 _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); 436 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr);
437 return _orientation; 437 return _orientation;
438 } 438 }
439 set 439 set
440 { 440 {
441 _orientation = value; 441 _orientation = value;
442 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 442 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
443 } 443 }
444 } 444 }
445 public override int PhysicsActorType { 445 public override int PhysicsActorType {
@@ -498,9 +498,9 @@ public sealed class BSCharacter : BSPhysObject
498 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() 498 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate()
499 { 499 {
500 if (_floatOnWater) 500 if (_floatOnWater)
501 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 501 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
502 else 502 else
503 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 503 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
504 }); 504 });
505 } 505 }
506 } 506 }
@@ -533,7 +533,7 @@ public sealed class BSCharacter : BSPhysObject
533 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 533 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
534 // Buoyancy is faked by changing the gravity applied to the object 534 // Buoyancy is faked by changing the gravity applied to the object
535 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 535 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
536 BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); 536 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
537 } 537 }
538 } 538 }
539 539
@@ -579,7 +579,7 @@ public sealed class BSCharacter : BSPhysObject
579 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() 579 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
580 { 580 {
581 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 581 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force);
582 BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); 582 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
583 }); 583 });
584 } 584 }
585 else 585 else
@@ -647,7 +647,7 @@ public sealed class BSCharacter : BSPhysObject
647 // That's just the way they are defined. 647 // That's just the way they are defined.
648 OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z); 648 OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z);
649 _velocity = avVel; 649 _velocity = avVel;
650 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); 650 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, avVel);
651 } 651 }
652 652
653 // Tell the linkset about value changes 653 // Tell the linkset about value changes