aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-30 10:21:47 -0800
committerRobert Adams2012-12-31 19:57:22 -0800
commit9218748321519ed04da5cdffa1f29e69030171b5 (patch)
tree7516cfbea32d716651430bc3124dbdd4cb772105 /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
parentBulletSim: add the implementation files for the two versions of Bullet: (diff)
downloadopensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.zip
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.gz
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.bz2
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.xz
BulletSim: another round of conversion: dynamics world and collision object functions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs46
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index d5ab245..328164b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -137,7 +137,7 @@ public sealed class BSCharacter : BSPhysObject
137 137
138 private void SetPhysicalProperties() 138 private void SetPhysicalProperties()
139 { 139 {
140 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 140 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
141 141
142 ZeroMotion(true); 142 ZeroMotion(true);
143 ForcePosition = _position; 143 ForcePosition = _position;
@@ -152,14 +152,14 @@ public sealed class BSCharacter : BSPhysObject
152 // Needs to be reset especially when an avatar is recreated after crossing a region boundry. 152 // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
153 Flying = _flying; 153 Flying = _flying;
154 154
155 BulletSimAPI.SetRestitution2(PhysBody.ptr, BSParam.AvatarRestitution); 155 PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
156 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin); 156 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin);
157 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 157 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
158 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, BSParam.ContactProcessingThreshold); 158 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
159 if (BSParam.CcdMotionThreshold > 0f) 159 if (BSParam.CcdMotionThreshold > 0f)
160 { 160 {
161 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, BSParam.CcdMotionThreshold); 161 PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
162 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); 162 PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
163 } 163 }
164 164
165 UpdatePhysicalMassProperties(RawMass, false); 165 UpdatePhysicalMassProperties(RawMass, false);
@@ -167,13 +167,13 @@ public sealed class BSCharacter : BSPhysObject
167 // Make so capsule does not fall over 167 // Make so capsule does not fall over
168 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); 168 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
169 169
170 BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 170 PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);
171 171
172 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 172 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
173 173
174 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 174 // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
175 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_DEACTIVATION); 175 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
176 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 176 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);
177 177
178 // Do this after the object has been added to the world 178 // Do this after the object has been added to the world
179 PhysBody.collisionType = CollisionType.Avatar; 179 PhysBody.collisionType = CollisionType.Avatar;
@@ -320,7 +320,7 @@ public sealed class BSCharacter : BSPhysObject
320 { 320 {
321 if (PhysBody.HasPhysicalBody) 321 if (PhysBody.HasPhysicalBody)
322 { 322 {
323 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 323 PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero);
324 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 324 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
325 // The next also get rid of applied linear force but the linear velocity is untouched. 325 // The next also get rid of applied linear force but the linear velocity is untouched.
326 BulletSimAPI.ClearForces2(PhysBody.ptr); 326 BulletSimAPI.ClearForces2(PhysBody.ptr);
@@ -350,19 +350,19 @@ public sealed class BSCharacter : BSPhysObject
350 { 350 {
351 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 351 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
352 if (PhysBody.HasPhysicalBody) 352 if (PhysBody.HasPhysicalBody)
353 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 353 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
354 }); 354 });
355 } 355 }
356 } 356 }
357 public override OMV.Vector3 ForcePosition { 357 public override OMV.Vector3 ForcePosition {
358 get { 358 get {
359 _position = BulletSimAPI.GetPosition2(PhysBody.ptr); 359 _position = PhysicsScene.PE.GetPosition(PhysBody);
360 return _position; 360 return _position;
361 } 361 }
362 set { 362 set {
363 _position = value; 363 _position = value;
364 PositionSanityCheck(); 364 PositionSanityCheck();
365 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 365 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
366 } 366 }
367 } 367 }
368 368
@@ -418,7 +418,7 @@ public sealed class BSCharacter : BSPhysObject
418 { 418 {
419 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 419 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
420 if (PhysBody.HasPhysicalBody) 420 if (PhysBody.HasPhysicalBody)
421 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 421 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
422 }); 422 });
423 ret = true; 423 ret = true;
424 } 424 }
@@ -520,7 +520,7 @@ public sealed class BSCharacter : BSPhysObject
520 { 520 {
521 _currentFriction = BSParam.AvatarStandingFriction; 521 _currentFriction = BSParam.AvatarStandingFriction;
522 if (PhysBody.HasPhysicalBody) 522 if (PhysBody.HasPhysicalBody)
523 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 523 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
524 } 524 }
525 } 525 }
526 else 526 else
@@ -529,12 +529,12 @@ public sealed class BSCharacter : BSPhysObject
529 { 529 {
530 _currentFriction = BSParam.AvatarFriction; 530 _currentFriction = BSParam.AvatarFriction;
531 if (PhysBody.HasPhysicalBody) 531 if (PhysBody.HasPhysicalBody)
532 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 532 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
533 } 533 }
534 } 534 }
535 535
536 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); 536 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
537 BulletSimAPI.Activate2(PhysBody.ptr, true); 537 PhysicsScene.PE.Activate(PhysBody, true);
538 } 538 }
539 } 539 }
540 public override OMV.Vector3 Torque { 540 public override OMV.Vector3 Torque {
@@ -576,7 +576,7 @@ public sealed class BSCharacter : BSPhysObject
576 { 576 {
577 get 577 get
578 { 578 {
579 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); 579 _orientation = PhysicsScene.PE.GetOrientation(PhysBody);
580 return _orientation; 580 return _orientation;
581 } 581 }
582 set 582 set
@@ -584,8 +584,8 @@ public sealed class BSCharacter : BSPhysObject
584 _orientation = value; 584 _orientation = value;
585 if (PhysBody.HasPhysicalBody) 585 if (PhysBody.HasPhysicalBody)
586 { 586 {
587 // _position = BulletSimAPI.GetPosition2(BSBody.ptr); 587 // _position = PhysicsScene.PE.GetPosition(BSBody);
588 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 588 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
589 } 589 }
590 } 590 }
591 } 591 }
@@ -636,9 +636,9 @@ public sealed class BSCharacter : BSPhysObject
636 if (PhysBody.HasPhysicalBody) 636 if (PhysBody.HasPhysicalBody)
637 { 637 {
638 if (_floatOnWater) 638 if (_floatOnWater)
639 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 639 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
640 else 640 else
641 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 641 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
642 } 642 }
643 }); 643 });
644 } 644 }