diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 50d11e6..a4ab702 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -187,6 +187,7 @@ public sealed class BSPrim : PhysicsActor | |||
187 | { | 187 | { |
188 | _mass = CalculateMass(); // changing size changes the mass | 188 | _mass = CalculateMass(); // changing size changes the mass |
189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); | 189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); |
190 | DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); | ||
190 | RecreateGeomAndObject(); | 191 | RecreateGeomAndObject(); |
191 | }); | 192 | }); |
192 | } | 193 | } |
@@ -972,7 +973,7 @@ public sealed class BSPrim : PhysicsActor | |||
972 | if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) | 973 | if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) |
973 | { | 974 | { |
974 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 975 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
975 | if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE) | 976 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
976 | { | 977 | { |
977 | DetailLog("{0},CreateGeom,sphere", LocalID); | 978 | DetailLog("{0},CreateGeom,sphere", LocalID); |
978 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; | 979 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; |
@@ -986,7 +987,7 @@ public sealed class BSPrim : PhysicsActor | |||
986 | else | 987 | else |
987 | { | 988 | { |
988 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); | 989 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); |
989 | if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX) | 990 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) |
990 | { | 991 | { |
991 | DetailLog("{0},CreateGeom,box", LocalID); | 992 | DetailLog("{0},CreateGeom,box", LocalID); |
992 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; | 993 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; |
@@ -1201,7 +1202,8 @@ public sealed class BSPrim : PhysicsActor | |||
1201 | 1202 | ||
1202 | // Create an object in Bullet if it has not already been created | 1203 | // Create an object in Bullet if it has not already been created |
1203 | // No locking here because this is done when the physics engine is not simulating | 1204 | // No locking here because this is done when the physics engine is not simulating |
1204 | private void CreateObject() | 1205 | // Returns 'true' if an object was actually created. |
1206 | private bool CreateObject() | ||
1205 | { | 1207 | { |
1206 | // this routine is called when objects are rebuilt. | 1208 | // this routine is called when objects are rebuilt. |
1207 | 1209 | ||
@@ -1209,10 +1211,12 @@ public sealed class BSPrim : PhysicsActor | |||
1209 | ShapeData shape; | 1211 | ShapeData shape; |
1210 | FillShapeInfo(out shape); | 1212 | FillShapeInfo(out shape); |
1211 | // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); | 1213 | // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); |
1212 | BulletSimAPI.CreateObject(_scene.WorldID, shape); | 1214 | bool ret = BulletSimAPI.CreateObject(_scene.WorldID, shape); |
1213 | 1215 | ||
1214 | // the CreateObject() may have recreated the rigid body. Make sure we have the latest. | 1216 | // the CreateObject() may have recreated the rigid body. Make sure we have the latest. |
1215 | m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); | 1217 | m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); |
1218 | |||
1219 | return ret; | ||
1216 | } | 1220 | } |
1217 | 1221 | ||
1218 | // Copy prim's info into the BulletSim shape description structure | 1222 | // Copy prim's info into the BulletSim shape description structure |
@@ -1327,7 +1331,6 @@ public sealed class BSPrim : PhysicsActor | |||
1327 | 1331 | ||
1328 | base.RequestPhysicsterseUpdate(); | 1332 | base.RequestPhysicsterseUpdate(); |
1329 | } | 1333 | } |
1330 | /* | ||
1331 | else | 1334 | else |
1332 | { | 1335 | { |
1333 | // For debugging, we can also report the movement of children | 1336 | // For debugging, we can also report the movement of children |
@@ -1335,7 +1338,6 @@ public sealed class BSPrim : PhysicsActor | |||
1335 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 1338 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
1336 | entprop.Acceleration, entprop.RotationalVelocity); | 1339 | entprop.Acceleration, entprop.RotationalVelocity); |
1337 | } | 1340 | } |
1338 | */ | ||
1339 | } | 1341 | } |
1340 | 1342 | ||
1341 | // I've collided with something | 1343 | // I've collided with something |