aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs38
1 files changed, 26 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 7590d93..50d11e6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -103,7 +103,10 @@ public sealed class BSPrim : PhysicsActor
103 long _collidingGroundStep; 103 long _collidingGroundStep;
104 104
105 private BulletBody m_body; 105 private BulletBody m_body;
106 public BulletBody Body { get { return m_body; } } 106 public BulletBody Body {
107 get { return m_body; }
108 set { m_body = value; }
109 }
107 110
108 private BSDynamics _vehicle; 111 private BSDynamics _vehicle;
109 112
@@ -477,9 +480,11 @@ public sealed class BSPrim : PhysicsActor
477 // Only called at taint time so it is save to call into Bullet. 480 // Only called at taint time so it is save to call into Bullet.
478 private void SetObjectDynamic() 481 private void SetObjectDynamic()
479 { 482 {
480 // m_log.DebugFormat("{0}: ID={1}, SetObjectDynamic: IsStatic={2}, IsSolid={3}", LogHeader, _localID, IsStatic, IsSolid); 483 // RA: remove this for the moment.
481 484 // The problem is that dynamic objects are hulls so if we are becoming physical
482 RecreateGeomAndObject(); 485 // the shape has to be checked and possibly built.
486 // Maybe a VerifyCorrectPhysicalShape() routine?
487 // RecreateGeomAndObject();
483 488
484 float mass = _mass; 489 float mass = _mass;
485 // Bullet wants static objects have a mass of zero 490 // Bullet wants static objects have a mass of zero
@@ -971,21 +976,23 @@ public sealed class BSPrim : PhysicsActor
971 { 976 {
972 DetailLog("{0},CreateGeom,sphere", LocalID); 977 DetailLog("{0},CreateGeom,sphere", LocalID);
973 _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; 978 _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE;
974 ret = true;
975 // Bullet native objects are scaled by the Bullet engine so pass the size in 979 // Bullet native objects are scaled by the Bullet engine so pass the size in
976 _scale = _size; 980 _scale = _size;
981 // TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
982 ret = true;
977 } 983 }
978 } 984 }
979 } 985 }
980 else 986 else
981 { 987 {
982 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, size={2}", LogHeader, LocalID, _size); 988 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size);
983 if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX) 989 if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)
984 { 990 {
985 DetailLog("{0},CreateGeom,box", LocalID); 991 DetailLog("{0},CreateGeom,box", LocalID);
986 _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; 992 _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX;
987 ret = true;
988 _scale = _size; 993 _scale = _size;
994 // TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
995 ret = true;
989 } 996 }
990 } 997 }
991 } 998 }
@@ -1203,11 +1210,9 @@ public sealed class BSPrim : PhysicsActor
1203 FillShapeInfo(out shape); 1210 FillShapeInfo(out shape);
1204 // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); 1211 // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type);
1205 BulletSimAPI.CreateObject(_scene.WorldID, shape); 1212 BulletSimAPI.CreateObject(_scene.WorldID, shape);
1213
1206 // the CreateObject() may have recreated the rigid body. Make sure we have the latest. 1214 // the CreateObject() may have recreated the rigid body. Make sure we have the latest.
1207 m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); 1215 m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID);
1208
1209 // The root object could have been recreated. Make sure everything linksety is up to date.
1210 _linkset.RefreshLinkset(this);
1211 } 1216 }
1212 1217
1213 // Copy prim's info into the BulletSim shape description structure 1218 // Copy prim's info into the BulletSim shape description structure
@@ -1236,8 +1241,8 @@ public sealed class BSPrim : PhysicsActor
1236 private void RecreateGeomAndObject() 1241 private void RecreateGeomAndObject()
1237 { 1242 {
1238 // m_log.DebugFormat("{0}: RecreateGeomAndObject. lID={1}", LogHeader, _localID); 1243 // m_log.DebugFormat("{0}: RecreateGeomAndObject. lID={1}", LogHeader, _localID);
1239 CreateGeom(true); 1244 if (CreateGeom(true))
1240 CreateObject(); 1245 CreateObject();
1241 return; 1246 return;
1242 } 1247 }
1243 1248
@@ -1322,6 +1327,15 @@ public sealed class BSPrim : PhysicsActor
1322 1327
1323 base.RequestPhysicsterseUpdate(); 1328 base.RequestPhysicsterseUpdate();
1324 } 1329 }
1330 /*
1331 else
1332 {
1333 // For debugging, we can also report the movement of children
1334 DetailLog("{0},UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
1335 LocalID, entprop.Position, entprop.Rotation, entprop.Velocity,
1336 entprop.Acceleration, entprop.RotationalVelocity);
1337 }
1338 */
1325 } 1339 }
1326 1340
1327 // I've collided with something 1341 // I've collided with something