diff options
author | Melanie | 2012-08-01 23:03:03 +0100 |
---|---|---|
committer | Melanie | 2012-08-01 23:03:03 +0100 |
commit | ecffcf7f65151a45b6396354d66fec70a7f3bad8 (patch) | |
tree | c2b98c522344cf713421b21ddb4452e537396f5a /OpenSim/Region/Physics | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.zip opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.gz opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.bz2 opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Physics/Manager/PhysicsScene.cs
Diffstat (limited to 'OpenSim/Region/Physics')
-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 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 5 |
4 files changed, 19 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 |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index cfede55..5274f3b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -71,6 +71,9 @@ namespace OpenSim.Region.Physics.Manager | |||
71 | All = 0x3f | 71 | All = 0x3f |
72 | } | 72 | } |
73 | 73 | ||
74 | public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); | ||
75 | public delegate void AssetReceivedDelegate(AssetBase asset); | ||
76 | |||
74 | /// <summary> | 77 | /// <summary> |
75 | /// Contact result from a raycast. | 78 | /// Contact result from a raycast. |
76 | /// </summary> | 79 | /// </summary> |
@@ -103,6 +106,8 @@ namespace OpenSim.Region.Physics.Manager | |||
103 | get { return new NullPhysicsScene(); } | 106 | get { return new NullPhysicsScene(); } |
104 | } | 107 | } |
105 | 108 | ||
109 | public RequestAssetDelegate RequestAssetMethod { private get; set; } | ||
110 | |||
106 | public virtual void TriggerPhysicsBasedRestart() | 111 | public virtual void TriggerPhysicsBasedRestart() |
107 | { | 112 | { |
108 | physicsCrash handler = OnPhysicsCrash; | 113 | physicsCrash handler = OnPhysicsCrash; |