diff options
author | Justin Clark-Casey (justincc) | 2012-08-01 00:40:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-08-01 00:40:31 +0100 |
commit | 69a5beeabca8471d84312a4f5e2e84f260a9f621 (patch) | |
tree | 228607e819ef9ad1eccf43ba2d8a99415ad6fdc6 /OpenSim/Region/Physics/BulletSPlugin | |
parent | Look up the NPC module when the SensorRepeat class is created, rather than on... (diff) | |
parent | BulletSim: fix problem where resizing a primary shape (cube or sphere) would ... (diff) | |
download | opensim-SC-69a5beeabca8471d84312a4f5e2e84f260a9f621.zip opensim-SC-69a5beeabca8471d84312a4f5e2e84f260a9f621.tar.gz opensim-SC-69a5beeabca8471d84312a4f5e2e84f260a9f621.tar.bz2 opensim-SC-69a5beeabca8471d84312a4f5e2e84f260a9f621.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 10 |
3 files changed, 14 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs index 07f5a21..ea3093a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs | |||
@@ -86,7 +86,7 @@ public class BSConstraint : IDisposable | |||
86 | 86 | ||
87 | public bool SetCFMAndERP(float cfm, float erp) | 87 | public bool SetCFMAndERP(float cfm, float erp) |
88 | { | 88 | { |
89 | bool ret = false; | 89 | bool ret = true; |
90 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 90 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
91 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); | 91 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); |
92 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 92 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
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 |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index fe705cc..0ffbc94 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -87,12 +87,12 @@ public struct ShapeData | |||
87 | public System.UInt64 MeshKey; | 87 | public System.UInt64 MeshKey; |
88 | public float Friction; | 88 | public float Friction; |
89 | public float Restitution; | 89 | public float Restitution; |
90 | public int Collidable; | 90 | public float Collidable; // true of things bump into this |
91 | public int Static; // true if a static object. Otherwise gravity, etc. | 91 | public float Static; // true if a static object. Otherwise gravity, etc. |
92 | 92 | ||
93 | // note that bools are passed as ints since bool size changes by language and architecture | 93 | // note that bools are passed as floats since bool size changes by language and architecture |
94 | public const int numericTrue = 1; | 94 | public const float numericTrue = 1f; |
95 | public const int numericFalse = 0; | 95 | public const float numericFalse = 0f; |
96 | } | 96 | } |
97 | [StructLayout(LayoutKind.Sequential)] | 97 | [StructLayout(LayoutKind.Sequential)] |
98 | public struct SweepHit | 98 | public struct SweepHit |