diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index e6aeebb..d137b2a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -442,8 +442,12 @@ public sealed class BSPrim : BSPhysObject | |||
442 | RegisterPreStepAction("BSPrim.setForce", LocalID, | 442 | RegisterPreStepAction("BSPrim.setForce", LocalID, |
443 | delegate(float timeStep) | 443 | delegate(float timeStep) |
444 | { | 444 | { |
445 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); | ||
445 | if (PhysBody.HasPhysicalBody) | 446 | if (PhysBody.HasPhysicalBody) |
447 | { | ||
446 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, _force); | 448 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, _force); |
449 | ActivateIfPhysical(false); | ||
450 | } | ||
447 | } | 451 | } |
448 | ); | 452 | ); |
449 | } | 453 | } |
@@ -554,7 +558,10 @@ public sealed class BSPrim : BSPhysObject | |||
554 | 558 | ||
555 | _velocity = value; | 559 | _velocity = value; |
556 | if (PhysBody.HasPhysicalBody) | 560 | if (PhysBody.HasPhysicalBody) |
561 | { | ||
557 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); | 562 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); |
563 | ActivateIfPhysical(false); | ||
564 | } | ||
558 | } | 565 | } |
559 | } | 566 | } |
560 | public override OMV.Vector3 Torque { | 567 | public override OMV.Vector3 Torque { |
@@ -845,7 +852,7 @@ public sealed class BSPrim : BSPhysObject | |||
845 | // Called in taint-time!! | 852 | // Called in taint-time!! |
846 | private void ActivateIfPhysical(bool forceIt) | 853 | private void ActivateIfPhysical(bool forceIt) |
847 | { | 854 | { |
848 | if (IsPhysical) | 855 | if (IsPhysical && PhysBody.HasPhysicalBody) |
849 | BulletSimAPI.Activate2(PhysBody.ptr, forceIt); | 856 | BulletSimAPI.Activate2(PhysBody.ptr, forceIt); |
850 | } | 857 | } |
851 | 858 | ||
@@ -919,8 +926,7 @@ public sealed class BSPrim : BSPhysObject | |||
919 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 926 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
920 | { | 927 | { |
921 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 928 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
922 | if (PhysBody.HasPhysicalBody) | 929 | ForceRotationalVelocity = _rotationalVelocity; |
923 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); | ||
924 | }); | 930 | }); |
925 | } | 931 | } |
926 | } | 932 | } |
@@ -930,7 +936,11 @@ public sealed class BSPrim : BSPhysObject | |||
930 | } | 936 | } |
931 | set { | 937 | set { |
932 | _rotationalVelocity = value; | 938 | _rotationalVelocity = value; |
933 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); | 939 | if (PhysBody.HasPhysicalBody) |
940 | { | ||
941 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); | ||
942 | ActivateIfPhysical(false); | ||
943 | } | ||
934 | } | 944 | } |
935 | } | 945 | } |
936 | public override bool Kinematic { | 946 | public override bool Kinematic { |
@@ -959,6 +969,7 @@ public sealed class BSPrim : BSPhysObject | |||
959 | { | 969 | { |
960 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | 970 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); |
961 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); | 971 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); |
972 | ActivateIfPhysical(false); | ||
962 | } | 973 | } |
963 | } | 974 | } |
964 | } | 975 | } |
@@ -1011,7 +1022,10 @@ public sealed class BSPrim : BSPhysObject | |||
1011 | // Bullet adds this central force to the total force for this tick | 1022 | // Bullet adds this central force to the total force for this tick |
1012 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); | 1023 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); |
1013 | if (PhysBody.HasPhysicalBody) | 1024 | if (PhysBody.HasPhysicalBody) |
1025 | { | ||
1014 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce); | 1026 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce); |
1027 | ActivateIfPhysical(false); | ||
1028 | } | ||
1015 | }); | 1029 | }); |
1016 | } | 1030 | } |
1017 | else | 1031 | else |
@@ -1032,7 +1046,10 @@ public sealed class BSPrim : BSPhysObject | |||
1032 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate() | 1046 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate() |
1033 | { | 1047 | { |
1034 | if (PhysBody.HasPhysicalBody) | 1048 | if (PhysBody.HasPhysicalBody) |
1049 | { | ||
1035 | BulletSimAPI.ApplyTorque2(PhysBody.ptr, angForce); | 1050 | BulletSimAPI.ApplyTorque2(PhysBody.ptr, angForce); |
1051 | ActivateIfPhysical(false); | ||
1052 | } | ||
1036 | }); | 1053 | }); |
1037 | } | 1054 | } |
1038 | else | 1055 | else |
@@ -1052,7 +1069,10 @@ public sealed class BSPrim : BSPhysObject | |||
1052 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() | 1069 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() |
1053 | { | 1070 | { |
1054 | if (PhysBody.HasPhysicalBody) | 1071 | if (PhysBody.HasPhysicalBody) |
1072 | { | ||
1055 | BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); | 1073 | BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); |
1074 | ActivateIfPhysical(false); | ||
1075 | } | ||
1056 | }); | 1076 | }); |
1057 | } | 1077 | } |
1058 | 1078 | ||