diff options
Diffstat (limited to 'OpenSim/Region')
4 files changed, 23 insertions, 15 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 07dd613..a041ba8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -105,7 +105,7 @@ public class BSCharacter : BSPhysObject | |||
105 | shapeData.Position = _position; | 105 | shapeData.Position = _position; |
106 | shapeData.Rotation = _orientation; | 106 | shapeData.Rotation = _orientation; |
107 | shapeData.Velocity = _velocity; | 107 | shapeData.Velocity = _velocity; |
108 | shapeData.Size = Scale; | 108 | shapeData.Size = Scale; // capsule is a native shape but scale is not just <1,1,1> |
109 | shapeData.Scale = Scale; | 109 | shapeData.Scale = Scale; |
110 | shapeData.Mass = _mass; | 110 | shapeData.Mass = _mass; |
111 | shapeData.Buoyancy = _buoyancy; | 111 | shapeData.Buoyancy = _buoyancy; |
@@ -144,7 +144,9 @@ public class BSCharacter : BSPhysObject | |||
144 | ForcePosition = _position; | 144 | ForcePosition = _position; |
145 | // Set the velocity and compute the proper friction | 145 | // Set the velocity and compute the proper friction |
146 | ForceVelocity = _velocity; | 146 | ForceVelocity = _velocity; |
147 | |||
147 | BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); | 148 | BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); |
149 | BulletSimAPI.SetMargin2(BSShape.ptr, PhysicsScene.Params.collisionMargin); | ||
148 | BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); | 150 | BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); |
149 | BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); | 151 | BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); |
150 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) | 152 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) |
@@ -156,11 +158,15 @@ public class BSCharacter : BSPhysObject | |||
156 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); | 158 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); |
157 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); | 159 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); |
158 | 160 | ||
161 | // Make so capsule does not fall over | ||
162 | BulletSimAPI.SetAngularFactorV2(BSBody.ptr, OMV.Vector3.Zero); | ||
163 | |||
159 | BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); | 164 | BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); |
160 | 165 | ||
161 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); | 166 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); |
162 | 167 | ||
163 | BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); | 168 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); |
169 | BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION); | ||
164 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); | 170 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); |
165 | 171 | ||
166 | // Do this after the object has been added to the world | 172 | // Do this after the object has been added to the world |
@@ -175,11 +181,13 @@ public class BSCharacter : BSPhysObject | |||
175 | } | 181 | } |
176 | // No one calls this method so I don't know what it could possibly mean | 182 | // No one calls this method so I don't know what it could possibly mean |
177 | public override bool Stopped { get { return false; } } | 183 | public override bool Stopped { get { return false; } } |
184 | |||
178 | public override OMV.Vector3 Size { | 185 | public override OMV.Vector3 Size { |
179 | get | 186 | get |
180 | { | 187 | { |
181 | // Avatar capsule size is kept in the scale parameter. | 188 | // Avatar capsule size is kept in the scale parameter. |
182 | return _size; | 189 | // return _size; |
190 | return new OMV.Vector3(Scale.X * 2f, Scale.Y * 2f, Scale.Z); | ||
183 | } | 191 | } |
184 | 192 | ||
185 | set { | 193 | set { |
@@ -199,7 +207,9 @@ public class BSCharacter : BSPhysObject | |||
199 | 207 | ||
200 | } | 208 | } |
201 | } | 209 | } |
210 | |||
202 | public override OMV.Vector3 Scale { get; set; } | 211 | public override OMV.Vector3 Scale { get; set; } |
212 | |||
203 | public override PrimitiveBaseShape Shape | 213 | public override PrimitiveBaseShape Shape |
204 | { | 214 | { |
205 | set { BaseShape = value; } | 215 | set { BaseShape = value; } |
@@ -264,7 +274,7 @@ public class BSCharacter : BSPhysObject | |||
264 | 274 | ||
265 | 275 | ||
266 | // Check that the current position is sane and, if not, modify the position to make it so. | 276 | // Check that the current position is sane and, if not, modify the position to make it so. |
267 | // Check for being below terrain and being out of bounds. | 277 | // Check for being below terrain or on water. |
268 | // Returns 'true' of the position was made sane by some action. | 278 | // Returns 'true' of the position was made sane by some action. |
269 | private bool PositionSanityCheck() | 279 | private bool PositionSanityCheck() |
270 | { | 280 | { |
@@ -335,7 +345,7 @@ public class BSCharacter : BSPhysObject | |||
335 | } | 345 | } |
336 | 346 | ||
337 | // Avatars don't do vehicles | 347 | // Avatars don't do vehicles |
338 | public override int VehicleType { get { return 0; } set { return; } } | 348 | public override int VehicleType { get { return (int)Vehicle.TYPE_NONE; } set { return; } } |
339 | public override void VehicleFloatParam(int param, float value) { } | 349 | public override void VehicleFloatParam(int param, float value) { } |
340 | public override void VehicleVectorParam(int param, OMV.Vector3 value) {} | 350 | public override void VehicleVectorParam(int param, OMV.Vector3 value) {} |
341 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) { } | 351 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) { } |
@@ -588,9 +598,8 @@ public class BSCharacter : BSPhysObject | |||
588 | newScale.X = PhysicsScene.Params.avatarCapsuleRadius; | 598 | newScale.X = PhysicsScene.Params.avatarCapsuleRadius; |
589 | newScale.Y = PhysicsScene.Params.avatarCapsuleRadius; | 599 | newScale.Y = PhysicsScene.Params.avatarCapsuleRadius; |
590 | 600 | ||
591 | // From the total height, remote the capsule half spheres that are at each end | 601 | // From the total height, remove the capsule half spheres that are at each end |
592 | newScale.Z = (size.Z * 2f) - Math.Min(newScale.X, newScale.Y); | 602 | newScale.Z = size.Z- (newScale.X + newScale.Y); |
593 | // newScale.Z = (size.Z * 2f); | ||
594 | Scale = newScale; | 603 | Scale = newScale; |
595 | } | 604 | } |
596 | 605 | ||
@@ -636,7 +645,7 @@ public class BSCharacter : BSPhysObject | |||
636 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); | 645 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); |
637 | } | 646 | } |
638 | 647 | ||
639 | // Tell the linkset about this | 648 | // Tell the linkset about value changes |
640 | Linkset.UpdateProperties(this); | 649 | Linkset.UpdateProperties(this); |
641 | 650 | ||
642 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. | 651 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index e686f2f..db0c99e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -692,7 +692,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
692 | { | 692 | { |
693 | if (_taintedObjects.Count > 0) // save allocating new list if there is nothing to process | 693 | if (_taintedObjects.Count > 0) // save allocating new list if there is nothing to process |
694 | { | 694 | { |
695 | // swizzle a new list into the list location so we can process what's there | ||
696 | int taintCount = m_taintsToProcessPerStep; | 695 | int taintCount = m_taintsToProcessPerStep; |
697 | TaintCallbackEntry oneCallback = new TaintCallbackEntry(); | 696 | TaintCallbackEntry oneCallback = new TaintCallbackEntry(); |
698 | while (_taintedObjects.Count > 0 && taintCount-- > 0) | 697 | while (_taintedObjects.Count > 0 && taintCount-- > 0) |
@@ -711,7 +710,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
711 | { | 710 | { |
712 | try | 711 | try |
713 | { | 712 | { |
714 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, oneCallback.ident); // DEBUG DEBUG DEBUG | 713 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, oneCallback.ident); |
715 | oneCallback.callback(); | 714 | oneCallback.callback(); |
716 | } | 715 | } |
717 | catch (Exception e) | 716 | catch (Exception e) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index d9427e1..30fa50a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -443,7 +443,8 @@ public class BSShapeCollection : IDisposable | |||
443 | if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) | 443 | if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) |
444 | { | 444 | { |
445 | newShape = new BulletShape( | 445 | newShape = new BulletShape( |
446 | BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1.0f, 1.0f, nativeShapeData.Scale), shapeType); | 446 | BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, nativeShapeData.Scale) |
447 | , shapeType); | ||
447 | DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", nativeShapeData.ID, nativeShapeData.Scale); | 448 | DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", nativeShapeData.ID, nativeShapeData.Scale); |
448 | } | 449 | } |
449 | else | 450 | else |
@@ -790,7 +791,6 @@ public class BSShapeCollection : IDisposable | |||
790 | // If the collisionObject is not the correct type for solidness, rebuild what's there | 791 | // If the collisionObject is not the correct type for solidness, rebuild what's there |
791 | mustRebuild = true; | 792 | mustRebuild = true; |
792 | } | 793 | } |
793 | |||
794 | } | 794 | } |
795 | 795 | ||
796 | if (mustRebuild || forceRebuild) | 796 | if (mustRebuild || forceRebuild) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index ae267e3..880859a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -333,8 +333,8 @@ public class BSTerrainManager | |||
333 | 333 | ||
334 | // Make sure the new shape is processed. | 334 | // Make sure the new shape is processed. |
335 | // BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true); | 335 | // BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true); |
336 | BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.ISLAND_SLEEPING); | 336 | // BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.ISLAND_SLEEPING); |
337 | // BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); | 337 | BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); |
338 | 338 | ||
339 | m_terrainModified = true; | 339 | m_terrainModified = true; |
340 | }; | 340 | }; |