aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-30 14:26:57 -0800
committerRobert Adams2012-12-31 19:57:23 -0800
commitc2a7af18b639646b647eb4cdff4168a2b9746ee4 (patch)
treeafe36195792b9990f7defd18bc29791f7527dcff /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
parentBulletSim: remove all the debug printing of pointer formatting (.ToString(X))... (diff)
downloadopensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.zip
opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.gz
opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.bz2
opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.xz
BulletSim: nearly complete in conversion from BulletSimAPI to BSAPITemplate. Only initialization and debug fuctions left.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs34
1 files changed, 17 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 328164b..103d8fc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -153,8 +153,8 @@ public sealed class BSCharacter : BSPhysObject
153 Flying = _flying; 153 Flying = _flying;
154 154
155 PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution); 155 PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
156 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin); 156 PhysicsScene.PE.SetMargin(PhysShape, PhysicsScene.Params.collisionMargin);
157 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 157 PhysicsScene.PE.SetLocalScaling(PhysShape, Scale);
158 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); 158 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
159 if (BSParam.CcdMotionThreshold > 0f) 159 if (BSParam.CcdMotionThreshold > 0f)
160 { 160 {
@@ -165,19 +165,19 @@ public sealed class BSCharacter : BSPhysObject
165 UpdatePhysicalMassProperties(RawMass, false); 165 UpdatePhysicalMassProperties(RawMass, false);
166 166
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 PhysicsScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero);
169 169
170 PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT); 170 PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);
171 171
172 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody); 172 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
173 173
174 // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG); 174 // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
175 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION); 175 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
176 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody); 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;
180 PhysBody.ApplyCollisionMask(); 180 PhysBody.ApplyCollisionMask(PhysicsScene);
181 } 181 }
182 182
183 // The avatar's movement is controlled by this motor that speeds up and slows down 183 // The avatar's movement is controlled by this motor that speeds up and slows down
@@ -265,10 +265,10 @@ public sealed class BSCharacter : BSPhysObject
265 { 265 {
266 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) 266 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
267 { 267 {
268 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 268 PhysicsScene.PE.SetLocalScaling(PhysShape, Scale);
269 UpdatePhysicalMassProperties(RawMass, true); 269 UpdatePhysicalMassProperties(RawMass, true);
270 // Make sure this change appears as a property update event 270 // Make sure this change appears as a property update event
271 BulletSimAPI.PushUpdate2(PhysBody.ptr); 271 PhysicsScene.PE.PushUpdate(PhysBody);
272 } 272 }
273 }); 273 });
274 274
@@ -309,7 +309,7 @@ public sealed class BSCharacter : BSPhysObject
309 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() 309 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
310 { 310 {
311 if (PhysBody.HasPhysicalBody) 311 if (PhysBody.HasPhysicalBody)
312 BulletSimAPI.ClearAllForces2(PhysBody.ptr); 312 PhysicsScene.PE.ClearAllForces(PhysBody);
313 }); 313 });
314 } 314 }
315 public override void ZeroAngularMotion(bool inTaintTime) 315 public override void ZeroAngularMotion(bool inTaintTime)
@@ -321,9 +321,9 @@ public sealed class BSCharacter : BSPhysObject
321 if (PhysBody.HasPhysicalBody) 321 if (PhysBody.HasPhysicalBody)
322 { 322 {
323 PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero); 323 PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero);
324 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 324 PhysicsScene.PE.SetAngularVelocity(PhysBody, 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 PhysicsScene.PE.ClearForces(PhysBody);
327 } 327 }
328 }); 328 });
329 } 329 }
@@ -339,7 +339,7 @@ public sealed class BSCharacter : BSPhysObject
339 public override OMV.Vector3 Position { 339 public override OMV.Vector3 Position {
340 get { 340 get {
341 // Don't refetch the position because this function is called a zillion times 341 // Don't refetch the position because this function is called a zillion times
342 // _position = BulletSimAPI.GetObjectPosition2(Scene.World.ptr, LocalID); 342 // _position = PhysicsScene.PE.GetObjectPosition(Scene.World, LocalID);
343 return _position; 343 return _position;
344 } 344 }
345 set { 345 set {
@@ -433,8 +433,8 @@ public sealed class BSCharacter : BSPhysObject
433 } 433 }
434 public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) 434 public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
435 { 435 {
436 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); 436 OMV.Vector3 localInertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape, physMass);
437 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); 437 PhysicsScene.PE.SetMassProps(PhysBody, physMass, localInertia);
438 } 438 }
439 439
440 public override OMV.Vector3 Force { 440 public override OMV.Vector3 Force {
@@ -446,7 +446,7 @@ public sealed class BSCharacter : BSPhysObject
446 { 446 {
447 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); 447 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force);
448 if (PhysBody.HasPhysicalBody) 448 if (PhysBody.HasPhysicalBody)
449 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 449 PhysicsScene.PE.SetObjectForce(PhysBody, _force);
450 }); 450 });
451 } 451 }
452 } 452 }
@@ -533,7 +533,7 @@ public sealed class BSCharacter : BSPhysObject
533 } 533 }
534 } 534 }
535 535
536 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); 536 PhysicsScene.PE.SetLinearVelocity(PhysBody, _velocity);
537 PhysicsScene.PE.Activate(PhysBody, true); 537 PhysicsScene.PE.Activate(PhysBody, true);
538 } 538 }
539 } 539 }
@@ -676,7 +676,7 @@ public sealed class BSCharacter : BSPhysObject
676 // Buoyancy is faked by changing the gravity applied to the object 676 // Buoyancy is faked by changing the gravity applied to the object
677 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 677 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
678 if (PhysBody.HasPhysicalBody) 678 if (PhysBody.HasPhysicalBody)
679 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); 679 PhysicsScene.PE.SetGravity(PhysBody, new OMV.Vector3(0f, 0f, grav));
680 } 680 }
681 } 681 }
682 682
@@ -737,7 +737,7 @@ public sealed class BSCharacter : BSPhysObject
737 // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); 737 // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
738 if (PhysBody.HasPhysicalBody) 738 if (PhysBody.HasPhysicalBody)
739 { 739 {
740 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce); 740 PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce);
741 } 741 }
742 }); 742 });
743 } 743 }