aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs120
1 files changed, 67 insertions, 53 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 4d203ff..c9c9c2c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -45,7 +45,6 @@ public sealed class BSPrim : BSPhysObject
45 private static readonly string LogHeader = "[BULLETS PRIM]"; 45 private static readonly string LogHeader = "[BULLETS PRIM]";
46 46
47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh. 47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh.
48 // Often Scale is unity because the meshmerizer will apply _size when creating the mesh.
49 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user 48 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user
50 49
51 private bool _grabbed; 50 private bool _grabbed;
@@ -93,7 +92,7 @@ public sealed class BSPrim : BSPhysObject
93 _physicsActorType = (int)ActorTypes.Prim; 92 _physicsActorType = (int)ActorTypes.Prim;
94 _position = pos; 93 _position = pos;
95 _size = size; 94 _size = size;
96 Scale = size; // the scale will be set by CreateGeom depending on object type 95 Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
97 _orientation = rotation; 96 _orientation = rotation;
98 _buoyancy = 1f; 97 _buoyancy = 1f;
99 _velocity = OMV.Vector3.Zero; 98 _velocity = OMV.Vector3.Zero;
@@ -108,8 +107,8 @@ public sealed class BSPrim : BSPhysObject
108 _mass = CalculateMass(); 107 _mass = CalculateMass();
109 108
110 // No body or shape yet 109 // No body or shape yet
111 PhysBody = new BulletBody(LocalID, IntPtr.Zero); 110 PhysBody = new BulletBody(LocalID);
112 PhysShape = new BulletShape(IntPtr.Zero); 111 PhysShape = new BulletShape();
113 112
114 DetailLog("{0},BSPrim.constructor,call", LocalID); 113 DetailLog("{0},BSPrim.constructor,call", LocalID);
115 // do the actual object creation at taint time 114 // do the actual object creation at taint time
@@ -143,7 +142,9 @@ public sealed class BSPrim : BSPhysObject
143 DetailLog("{0},BSPrim.Destroy,taint,", LocalID); 142 DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
144 // If there are physical body and shape, release my use of same. 143 // If there are physical body and shape, release my use of same.
145 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); 144 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null);
145 PhysBody.Clear();
146 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); 146 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null);
147 PhysShape.Clear();
147 }); 148 });
148 } 149 }
149 150
@@ -157,12 +158,10 @@ public sealed class BSPrim : BSPhysObject
157 // We presume the scale and size are the same. If scale must be changed for 158 // We presume the scale and size are the same. If scale must be changed for
158 // the physical shape, that is done when the geometry is built. 159 // the physical shape, that is done when the geometry is built.
159 _size = value; 160 _size = value;
161 Scale = _size;
160 ForceBodyShapeRebuild(false); 162 ForceBodyShapeRebuild(false);
161 } 163 }
162 } 164 }
163 // Scale is what we set in the physics engine. It is different than 'size' in that
164 // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>.
165 public override OMV.Vector3 Scale { get; set; }
166 165
167 public override PrimitiveBaseShape Shape { 166 public override PrimitiveBaseShape Shape {
168 set { 167 set {
@@ -189,7 +188,8 @@ public sealed class BSPrim : BSPhysObject
189 } 188 }
190 } 189 }
191 public override bool Selected { 190 public override bool Selected {
192 set { 191 set
192 {
193 if (value != _isSelected) 193 if (value != _isSelected)
194 { 194 {
195 _isSelected = value; 195 _isSelected = value;
@@ -247,7 +247,8 @@ public sealed class BSPrim : BSPhysObject
247 // Zero some other properties in the physics engine 247 // Zero some other properties in the physics engine
248 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 248 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
249 { 249 {
250 BulletSimAPI.ClearAllForces2(PhysBody.ptr); 250 if (PhysBody.HasPhysicalBody)
251 BulletSimAPI.ClearAllForces2(PhysBody.ptr);
251 }); 252 });
252 } 253 }
253 public override void ZeroAngularMotion(bool inTaintTime) 254 public override void ZeroAngularMotion(bool inTaintTime)
@@ -257,8 +258,11 @@ public sealed class BSPrim : BSPhysObject
257 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 258 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
258 { 259 {
259 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); 260 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
260 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 261 if (PhysBody.HasPhysicalBody)
261 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 262 {
263 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
264 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
265 }
262 }); 266 });
263 } 267 }
264 268
@@ -295,8 +299,11 @@ public sealed class BSPrim : BSPhysObject
295 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() 299 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
296 { 300 {
297 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 301 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
298 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 302 if (PhysBody.HasPhysicalBody)
299 ActivateIfPhysical(false); 303 {
304 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
305 ActivateIfPhysical(false);
306 }
300 }); 307 });
301 } 308 }
302 } 309 }
@@ -322,12 +329,12 @@ public sealed class BSPrim : BSPhysObject
322 329
323 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); 330 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position);
324 OMV.Vector3 upForce = OMV.Vector3.Zero; 331 OMV.Vector3 upForce = OMV.Vector3.Zero;
325 if (Position.Z < terrainHeight) 332 if (RawPosition.Z < terrainHeight)
326 { 333 {
327 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight); 334 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight);
328 float targetHeight = terrainHeight + (Size.Z / 2f); 335 float targetHeight = terrainHeight + (Size.Z / 2f);
329 // Upforce proportional to the distance away from the terrain. Correct the error in 1 sec. 336 // Upforce proportional to the distance away from the terrain. Correct the error in 1 sec.
330 upForce.Z = (terrainHeight - Position.Z) * 1f; 337 upForce.Z = (terrainHeight - RawPosition.Z) * 1f;
331 ret = true; 338 ret = true;
332 } 339 }
333 340
@@ -335,10 +342,10 @@ public sealed class BSPrim : BSPhysObject
335 { 342 {
336 float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position); 343 float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position);
337 // TODO: a floating motor so object will bob in the water 344 // TODO: a floating motor so object will bob in the water
338 if (Math.Abs(Position.Z - waterHeight) > 0.1f) 345 if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f)
339 { 346 {
340 // Upforce proportional to the distance away from the water. Correct the error in 1 sec. 347 // Upforce proportional to the distance away from the water. Correct the error in 1 sec.
341 upForce.Z = (waterHeight - Position.Z) * 1f; 348 upForce.Z = (waterHeight - RawPosition.Z) * 1f;
342 ret = true; 349 ret = true;
343 } 350 }
344 } 351 }
@@ -413,7 +420,8 @@ public sealed class BSPrim : BSPhysObject
413 PhysicsScene.TaintedObject("BSPrim.setForce", delegate() 420 PhysicsScene.TaintedObject("BSPrim.setForce", delegate()
414 { 421 {
415 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); 422 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
416 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 423 if (PhysBody.HasPhysicalBody)
424 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
417 }); 425 });
418 } 426 }
419 } 427 }
@@ -507,7 +515,8 @@ public sealed class BSPrim : BSPhysObject
507 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() 515 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate()
508 { 516 {
509 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); 517 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
510 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); 518 if (PhysBody.HasPhysicalBody)
519 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
511 }); 520 });
512 } 521 }
513 } 522 }
@@ -556,9 +565,12 @@ public sealed class BSPrim : BSPhysObject
556 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? 565 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint?
557 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() 566 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
558 { 567 {
559 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); 568 if (PhysBody.HasPhysicalBody)
560 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 569 {
561 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 570 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
571 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
572 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
573 }
562 }); 574 });
563 } 575 }
564 } 576 }
@@ -649,14 +661,7 @@ public sealed class BSPrim : BSPhysObject
649 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 661 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
650 662
651 // Collision filter can be set only when the object is in the world 663 // Collision filter can be set only when the object is in the world
652 if (PhysBody.collisionGroup != 0 || PhysBody.collisionMask != 0) 664 PhysBody.ApplyCollisionMask();
653 {
654 if (!BulletSimAPI.SetCollisionGroupMask2(PhysBody.ptr, (uint)PhysBody.collisionGroup, (uint)PhysBody.collisionMask))
655 {
656 PhysicsScene.Logger.ErrorFormat("{0} Failure setting prim collision mask. localID={1}, grp={2:X}, mask={3:X}",
657 LogHeader, LocalID, PhysBody.collisionGroup, PhysBody.collisionMask);
658 }
659 }
660 665
661 // Recompute any linkset parameters. 666 // Recompute any linkset parameters.
662 // When going from non-physical to physical, this re-enables the constraints that 667 // When going from non-physical to physical, this re-enables the constraints that
@@ -683,8 +688,9 @@ public sealed class BSPrim : BSPhysObject
683 ZeroMotion(true); 688 ZeroMotion(true);
684 689
685 // Set various physical properties so other object interact properly 690 // Set various physical properties so other object interact properly
686 BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); 691 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
687 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); 692 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction);
693 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution);
688 694
689 // Mass is zero which disables a bunch of physics stuff in Bullet 695 // Mass is zero which disables a bunch of physics stuff in Bullet
690 UpdatePhysicalMassProperties(0f); 696 UpdatePhysicalMassProperties(0f);
@@ -700,20 +706,21 @@ public sealed class BSPrim : BSPhysObject
700 // Start it out sleeping and physical actions could wake it up. 706 // Start it out sleeping and physical actions could wake it up.
701 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); 707 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING);
702 708
709 // This collides like a static object
710 PhysBody.collisionType = CollisionType.Static;
711
703 // There can be special things needed for implementing linksets 712 // There can be special things needed for implementing linksets
704 Linkset.MakeStatic(this); 713 Linkset.MakeStatic(this);
705
706 PhysBody.collisionGroup = CollisionFilterGroups.StaticObjectGroup;
707 PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask;
708 } 714 }
709 else 715 else
710 { 716 {
711 // Not a Bullet static object 717 // Not a Bullet static object
712 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 718 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
713 719
714 // Set various physical properties so internal dynamic properties will get computed correctly as they are set 720 // Set various physical properties so other object interact properly
715 BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); 721 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, true);
716 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); 722 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction);
723 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution);
717 724
718 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 725 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382
719 // Since this can be called multiple times, only zero forces when becoming physical 726 // Since this can be called multiple times, only zero forces when becoming physical
@@ -741,16 +748,15 @@ public sealed class BSPrim : BSPhysObject
741 BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); 748 BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold);
742 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 749 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
743 750
744 // There might be special things needed for implementing linksets. 751 // This collides like an object.
745 Linkset.MakeDynamic(this); 752 PhysBody.collisionType = CollisionType.Dynamic;
746 753
747 // Force activation of the object so Bullet will act on it. 754 // Force activation of the object so Bullet will act on it.
748 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. 755 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects.
749 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); 756 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG);
750 // BulletSimAPI.Activate2(BSBody.ptr, true);
751 757
752 PhysBody.collisionGroup = CollisionFilterGroups.ObjectGroup; 758 // There might be special things needed for implementing linksets.
753 PhysBody.collisionMask = CollisionFilterGroups.ObjectMask; 759 Linkset.MakeDynamic(this);
754 } 760 }
755 } 761 }
756 762
@@ -777,8 +783,9 @@ public sealed class BSPrim : BSPhysObject
777 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); 783 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType);
778 } 784 }
779 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 785 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE);
780 PhysBody.collisionGroup = CollisionFilterGroups.VolumeDetectGroup; 786
781 PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; 787 // Change collision info from a static object to a ghosty collision object
788 PhysBody.collisionType = CollisionType.VolumeDetect;
782 } 789 }
783 } 790 }
784 791
@@ -861,7 +868,8 @@ public sealed class BSPrim : BSPhysObject
861 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 868 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
862 { 869 {
863 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); 870 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
864 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 871 if (PhysBody.HasPhysicalBody)
872 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
865 }); 873 });
866 } 874 }
867 } 875 }
@@ -896,8 +904,11 @@ public sealed class BSPrim : BSPhysObject
896 _buoyancy = value; 904 _buoyancy = value;
897 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 905 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
898 // Buoyancy is faked by changing the gravity applied to the object 906 // Buoyancy is faked by changing the gravity applied to the object
899 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 907 if (PhysBody.HasPhysicalBody)
900 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); 908 {
909 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
910 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
911 }
901 } 912 }
902 } 913 }
903 914
@@ -965,7 +976,8 @@ public sealed class BSPrim : BSPhysObject
965 } 976 }
966 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum); 977 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum);
967 if (fSum != OMV.Vector3.Zero) 978 if (fSum != OMV.Vector3.Zero)
968 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum); 979 if (PhysBody.HasPhysicalBody)
980 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum);
969 }); 981 });
970 } 982 }
971 983
@@ -976,7 +988,8 @@ public sealed class BSPrim : BSPhysObject
976 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyForceImpulse", delegate() 988 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyForceImpulse", delegate()
977 { 989 {
978 DetailLog("{0},BSPrim.ApplyForceImpulse,taint,tImpulse={1}", LocalID, applyImpulse); 990 DetailLog("{0},BSPrim.ApplyForceImpulse,taint,tImpulse={1}", LocalID, applyImpulse);
979 BulletSimAPI.ApplyCentralImpulse2(PhysBody.ptr, applyImpulse); 991 if (PhysBody.HasPhysicalBody)
992 BulletSimAPI.ApplyCentralImpulse2(PhysBody.ptr, applyImpulse);
980 }); 993 });
981 } 994 }
982 995
@@ -1012,7 +1025,8 @@ public sealed class BSPrim : BSPhysObject
1012 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum); 1025 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum);
1013 if (fSum != OMV.Vector3.Zero) 1026 if (fSum != OMV.Vector3.Zero)
1014 { 1027 {
1015 BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum); 1028 if (PhysBody.HasPhysicalBody)
1029 BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum);
1016 _torque = fSum; 1030 _torque = fSum;
1017 } 1031 }
1018 }); 1032 });
@@ -1026,7 +1040,8 @@ public sealed class BSPrim : BSPhysObject
1026 OMV.Vector3 applyImpulse = impulse; 1040 OMV.Vector3 applyImpulse = impulse;
1027 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() 1041 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate()
1028 { 1042 {
1029 BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); 1043 if (PhysBody.HasPhysicalBody)
1044 BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse);
1030 }); 1045 });
1031 } 1046 }
1032 1047
@@ -1344,7 +1359,6 @@ public sealed class BSPrim : BSPhysObject
1344 // Create the correct physical representation for this type of object. 1359 // Create the correct physical representation for this type of object.
1345 // Updates PhysBody and PhysShape with the new information. 1360 // Updates PhysBody and PhysShape with the new information.
1346 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. 1361 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary.
1347 // Returns 'true' if either the body or the shape was changed.
1348 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) 1362 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody)
1349 { 1363 {
1350 // Called if the current prim body is about to be destroyed. 1364 // Called if the current prim body is about to be destroyed.