diff options
author | Robert Adams | 2013-08-12 13:44:53 -0700 |
---|---|---|
committer | Robert Adams | 2013-08-12 13:44:53 -0700 |
commit | 2c31fe4614fc193f2600b36eac892ceee86f61e0 (patch) | |
tree | 3a986998ebbd3278e848bb61fc5787f6410f9838 /OpenSim/Region/Physics/BulletSPlugin | |
parent | Don't try and send group updates to NPCs via event queue, since NPCs have no ... (diff) | |
download | opensim-SC_OLD-2c31fe4614fc193f2600b36eac892ceee86f61e0.zip opensim-SC_OLD-2c31fe4614fc193f2600b36eac892ceee86f61e0.tar.gz opensim-SC_OLD-2c31fe4614fc193f2600b36eac892ceee86f61e0.tar.bz2 opensim-SC_OLD-2c31fe4614fc193f2600b36eac892ceee86f61e0.tar.xz |
BulletSim: add check in avatar stair step code to verify the collision
is not with a volume detect object.
This fixes a problem of avatars trying to step over a volume detect object
that they collide with. This appeared as the avatar popping up as it started
to step up but then continuing on since the object wasn't physically interacting.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
4 files changed, 26 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 0f11c4a..5f232a4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -311,21 +311,28 @@ public class BSActorAvatarMove : BSActor | |||
311 | // Don't care about collisions with the terrain | 311 | // Don't care about collisions with the terrain |
312 | if (kvp.Key > m_physicsScene.TerrainManager.HighestTerrainID) | 312 | if (kvp.Key > m_physicsScene.TerrainManager.HighestTerrainID) |
313 | { | 313 | { |
314 | OMV.Vector3 touchPosition = kvp.Value.Position; | 314 | BSPhysObject collisionObject; |
315 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,min={1},max={2},touch={3}", | 315 | if (m_physicsScene.PhysObjects.TryGetValue(kvp.Key, out collisionObject)) |
316 | m_controllingPrim.LocalID, nearFeetHeightMin, nearFeetHeightMax, touchPosition); | ||
317 | if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax) | ||
318 | { | 316 | { |
319 | // This contact is within the 'near the feet' range. | 317 | if (!collisionObject.IsVolumeDetect) |
320 | // The normal should be our contact point to the object so it is pointing away | ||
321 | // thus the difference between our facing orientation and the normal should be small. | ||
322 | OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation; | ||
323 | OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal); | ||
324 | float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)); | ||
325 | if (diff < BSParam.AvatarStepApproachFactor) | ||
326 | { | 318 | { |
327 | if (highestTouchPosition.Z < touchPosition.Z) | 319 | OMV.Vector3 touchPosition = kvp.Value.Position; |
328 | highestTouchPosition = touchPosition; | 320 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,min={1},max={2},touch={3}", |
321 | m_controllingPrim.LocalID, nearFeetHeightMin, nearFeetHeightMax, touchPosition); | ||
322 | if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax) | ||
323 | { | ||
324 | // This contact is within the 'near the feet' range. | ||
325 | // The normal should be our contact point to the object so it is pointing away | ||
326 | // thus the difference between our facing orientation and the normal should be small. | ||
327 | OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation; | ||
328 | OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal); | ||
329 | float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)); | ||
330 | if (diff < BSParam.AvatarStepApproachFactor) | ||
331 | { | ||
332 | if (highestTouchPosition.Z < touchPosition.Z) | ||
333 | highestTouchPosition = touchPosition; | ||
334 | } | ||
335 | } | ||
329 | } | 336 | } |
330 | } | 337 | } |
331 | } | 338 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 9af3dce..d584782 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -404,6 +404,7 @@ public sealed class BSCharacter : BSPhysObject | |||
404 | 404 | ||
405 | // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more | 405 | // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more |
406 | public override void SetVolumeDetect(int param) { return; } | 406 | public override void SetVolumeDetect(int param) { return; } |
407 | public override bool IsVolumeDetect { get { return false; } } | ||
407 | 408 | ||
408 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } | 409 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } |
409 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } | 410 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 0704591..27caf62 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -175,6 +175,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
175 | public abstract bool IsSolid { get; } | 175 | public abstract bool IsSolid { get; } |
176 | public abstract bool IsStatic { get; } | 176 | public abstract bool IsStatic { get; } |
177 | public abstract bool IsSelected { get; } | 177 | public abstract bool IsSelected { get; } |
178 | public abstract bool IsVolumeDetect { get; } | ||
178 | 179 | ||
179 | // Materialness | 180 | // Materialness |
180 | public MaterialAttributes.Material Material { get; private set; } | 181 | public MaterialAttributes.Material Material { get; private set; } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index a0b6abc..6b5dea3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -617,6 +617,10 @@ public class BSPrim : BSPhysObject | |||
617 | } | 617 | } |
618 | return; | 618 | return; |
619 | } | 619 | } |
620 | public override bool IsVolumeDetect | ||
621 | { | ||
622 | get { return _isVolumeDetect; } | ||
623 | } | ||
620 | public override void SetMaterial(int material) | 624 | public override void SetMaterial(int material) |
621 | { | 625 | { |
622 | base.SetMaterial(material); | 626 | base.SetMaterial(material); |