diff options
author | Robert Adams | 2012-12-30 14:26:57 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:23 -0800 |
commit | c2a7af18b639646b647eb4cdff4168a2b9746ee4 (patch) | |
tree | afe36195792b9990f7defd18bc29791f7527dcff /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: remove all the debug printing of pointer formatting (.ToString(X))... (diff) | |
download | opensim-SC-c2a7af18b639646b647eb4cdff4168a2b9746ee4.zip opensim-SC-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.gz opensim-SC-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.bz2 opensim-SC-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/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 613606f..064ce3c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -253,7 +253,7 @@ public sealed class BSPrim : BSPhysObject | |||
253 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() | 253 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() |
254 | { | 254 | { |
255 | if (PhysBody.HasPhysicalBody) | 255 | if (PhysBody.HasPhysicalBody) |
256 | BulletSimAPI.ClearAllForces2(PhysBody.ptr); | 256 | PhysicsScene.PE.ClearAllForces(PhysBody); |
257 | }); | 257 | }); |
258 | } | 258 | } |
259 | public override void ZeroAngularMotion(bool inTaintTime) | 259 | public override void ZeroAngularMotion(bool inTaintTime) |
@@ -266,7 +266,7 @@ public sealed class BSPrim : BSPhysObject | |||
266 | if (PhysBody.HasPhysicalBody) | 266 | if (PhysBody.HasPhysicalBody) |
267 | { | 267 | { |
268 | PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); | 268 | PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); |
269 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); | 269 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); |
270 | } | 270 | } |
271 | }); | 271 | }); |
272 | } | 272 | } |
@@ -292,7 +292,7 @@ public sealed class BSPrim : BSPhysObject | |||
292 | */ | 292 | */ |
293 | 293 | ||
294 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. | 294 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. |
295 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 295 | // _position = PhysicsScene.PE.GetObjectPosition2(PhysicsScene.World, BSBody); |
296 | return _position; | 296 | return _position; |
297 | } | 297 | } |
298 | set { | 298 | set { |
@@ -405,10 +405,10 @@ public sealed class BSPrim : BSPhysObject | |||
405 | { | 405 | { |
406 | if (IsStatic) | 406 | if (IsStatic) |
407 | { | 407 | { |
408 | BulletSimAPI.SetGravity2(PhysBody.ptr, PhysicsScene.DefaultGravity); | 408 | PhysicsScene.PE.SetGravity(PhysBody, PhysicsScene.DefaultGravity); |
409 | Inertia = OMV.Vector3.Zero; | 409 | Inertia = OMV.Vector3.Zero; |
410 | BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia); | 410 | PhysicsScene.PE.SetMassProps(PhysBody, 0f, Inertia); |
411 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); | 411 | PhysicsScene.PE.UpdateInertiaTensor(PhysBody); |
412 | } | 412 | } |
413 | else | 413 | else |
414 | { | 414 | { |
@@ -423,14 +423,14 @@ public sealed class BSPrim : BSPhysObject | |||
423 | } | 423 | } |
424 | 424 | ||
425 | // The computation of mass props requires gravity to be set on the object. | 425 | // The computation of mass props requires gravity to be set on the object. |
426 | BulletSimAPI.SetGravity2(PhysBody.ptr, grav); | 426 | PhysicsScene.PE.SetGravity(PhysBody, grav); |
427 | 427 | ||
428 | Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); | 428 | Inertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape, physMass); |
429 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); | 429 | PhysicsScene.PE.SetMassProps(PhysBody, physMass, Inertia); |
430 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); | 430 | PhysicsScene.PE.UpdateInertiaTensor(PhysBody); |
431 | 431 | ||
432 | // center of mass is at the zero of the object | 432 | // center of mass is at the zero of the object |
433 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); | 433 | // DEBUG DEBUG PhysicsScene.PE.SetCenterOfMassByPosRot(PhysBody, ForcePosition, ForceOrientation); |
434 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}", LocalID, physMass, Inertia, grav, inWorld); | 434 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}", LocalID, physMass, Inertia, grav, inWorld); |
435 | 435 | ||
436 | if (inWorld) | 436 | if (inWorld) |
@@ -440,7 +440,7 @@ public sealed class BSPrim : BSPhysObject | |||
440 | 440 | ||
441 | // Must set gravity after it has been added to the world because, for unknown reasons, | 441 | // Must set gravity after it has been added to the world because, for unknown reasons, |
442 | // adding the object resets the object's gravity to world gravity | 442 | // adding the object resets the object's gravity to world gravity |
443 | BulletSimAPI.SetGravity2(PhysBody.ptr, grav); | 443 | PhysicsScene.PE.SetGravity(PhysBody, grav); |
444 | 444 | ||
445 | } | 445 | } |
446 | } | 446 | } |
@@ -483,7 +483,7 @@ public sealed class BSPrim : BSPhysObject | |||
483 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); | 483 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); |
484 | if (PhysBody.HasPhysicalBody) | 484 | if (PhysBody.HasPhysicalBody) |
485 | { | 485 | { |
486 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, _force); | 486 | PhysicsScene.PE.ApplyCentralForce(PhysBody, _force); |
487 | ActivateIfPhysical(false); | 487 | ActivateIfPhysical(false); |
488 | } | 488 | } |
489 | } | 489 | } |
@@ -583,7 +583,7 @@ public sealed class BSPrim : BSPhysObject | |||
583 | _velocity = value; | 583 | _velocity = value; |
584 | if (PhysBody.HasPhysicalBody) | 584 | if (PhysBody.HasPhysicalBody) |
585 | { | 585 | { |
586 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); | 586 | PhysicsScene.PE.SetLinearVelocity(PhysBody, _velocity); |
587 | ActivateIfPhysical(false); | 587 | ActivateIfPhysical(false); |
588 | } | 588 | } |
589 | } | 589 | } |
@@ -809,7 +809,7 @@ public sealed class BSPrim : BSPhysObject | |||
809 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 809 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); |
810 | 810 | ||
811 | // Center of mass is at the center of the object | 811 | // Center of mass is at the center of the object |
812 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody, _position, _orientation); | 812 | // DEBUG DEBUG PhysicsScene.PE.SetCenterOfMassByPosRot(Linkset.LinksetRoot.PhysBody, _position, _orientation); |
813 | 813 | ||
814 | // A dynamic object has mass | 814 | // A dynamic object has mass |
815 | UpdatePhysicalMassProperties(RawMass, false); | 815 | UpdatePhysicalMassProperties(RawMass, false); |
@@ -822,9 +822,9 @@ public sealed class BSPrim : BSPhysObject | |||
822 | } | 822 | } |
823 | 823 | ||
824 | // Various values for simulation limits | 824 | // Various values for simulation limits |
825 | BulletSimAPI.SetDamping2(PhysBody.ptr, BSParam.LinearDamping, BSParam.AngularDamping); | 825 | PhysicsScene.PE.SetDamping(PhysBody, BSParam.LinearDamping, BSParam.AngularDamping); |
826 | PhysicsScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime); | 826 | PhysicsScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime); |
827 | BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold); | 827 | PhysicsScene.PE.SetSleepingThresholds(PhysBody, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold); |
828 | PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); | 828 | PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); |
829 | 829 | ||
830 | // This collides like an object. | 830 | // This collides like an object. |
@@ -901,10 +901,10 @@ public sealed class BSPrim : BSPhysObject | |||
901 | 901 | ||
902 | // TODO: Fix this. Total kludge because adding object to world resets its gravity to default. | 902 | // TODO: Fix this. Total kludge because adding object to world resets its gravity to default. |
903 | // Replace this when the new AddObjectToWorld function is complete. | 903 | // Replace this when the new AddObjectToWorld function is complete. |
904 | BulletSimAPI.SetGravity2(PhysBody.ptr, ComputeGravity()); | 904 | PhysicsScene.PE.SetGravity(PhysBody, ComputeGravity()); |
905 | 905 | ||
906 | // Collision filter can be set only when the object is in the world | 906 | // Collision filter can be set only when the object is in the world |
907 | if (!PhysBody.ApplyCollisionMask()) | 907 | if (!PhysBody.ApplyCollisionMask(PhysicsScene)) |
908 | { | 908 | { |
909 | m_log.ErrorFormat("{0} Failed setting object collision mask: id={1}", LogHeader, LocalID); | 909 | m_log.ErrorFormat("{0} Failed setting object collision mask: id={1}", LogHeader, LocalID); |
910 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,failedSetMaskGroup,cType={1}", LocalID, PhysBody.collisionType); | 910 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,failedSetMaskGroup,cType={1}", LocalID, PhysBody.collisionType); |
@@ -969,7 +969,7 @@ public sealed class BSPrim : BSPhysObject | |||
969 | _rotationalVelocity = value; | 969 | _rotationalVelocity = value; |
970 | if (PhysBody.HasPhysicalBody) | 970 | if (PhysBody.HasPhysicalBody) |
971 | { | 971 | { |
972 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); | 972 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); |
973 | ActivateIfPhysical(false); | 973 | ActivateIfPhysical(false); |
974 | } | 974 | } |
975 | } | 975 | } |
@@ -1061,7 +1061,7 @@ public sealed class BSPrim : BSPhysObject | |||
1061 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); | 1061 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); |
1062 | if (PhysBody.HasPhysicalBody) | 1062 | if (PhysBody.HasPhysicalBody) |
1063 | { | 1063 | { |
1064 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce); | 1064 | PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce); |
1065 | ActivateIfPhysical(false); | 1065 | ActivateIfPhysical(false); |
1066 | } | 1066 | } |
1067 | }); | 1067 | }); |
@@ -1085,7 +1085,7 @@ public sealed class BSPrim : BSPhysObject | |||
1085 | { | 1085 | { |
1086 | if (PhysBody.HasPhysicalBody) | 1086 | if (PhysBody.HasPhysicalBody) |
1087 | { | 1087 | { |
1088 | BulletSimAPI.ApplyTorque2(PhysBody.ptr, angForce); | 1088 | PhysicsScene.PE.ApplyTorque(PhysBody, angForce); |
1089 | ActivateIfPhysical(false); | 1089 | ActivateIfPhysical(false); |
1090 | } | 1090 | } |
1091 | }); | 1091 | }); |
@@ -1108,7 +1108,7 @@ public sealed class BSPrim : BSPhysObject | |||
1108 | { | 1108 | { |
1109 | if (PhysBody.HasPhysicalBody) | 1109 | if (PhysBody.HasPhysicalBody) |
1110 | { | 1110 | { |
1111 | BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); | 1111 | PhysicsScene.PE.ApplyTorqueImpulse(PhysBody, applyImpulse); |
1112 | ActivateIfPhysical(false); | 1112 | ActivateIfPhysical(false); |
1113 | } | 1113 | } |
1114 | }); | 1114 | }); |