aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2017-09-05 06:19:49 -0700
committerRobert Adams2017-09-05 06:19:49 -0700
commit4608b448171c931718a1fdf2eaf5c0eb55c9ef31 (patch)
treeed97116aee1c5c9ede7022677c37f7285e75af21 /OpenSim
parentBulletSim: first version of raycast. Only single contact point and no (diff)
downloadopensim-SC-4608b448171c931718a1fdf2eaf5c0eb55c9ef31.zip
opensim-SC-4608b448171c931718a1fdf2eaf5c0eb55c9ef31.tar.gz
opensim-SC-4608b448171c931718a1fdf2eaf5c0eb55c9ef31.tar.bz2
opensim-SC-4608b448171c931718a1fdf2eaf5c0eb55c9ef31.tar.xz
BulletSim: add raycast filtering
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSScene.cs38
1 files changed, 35 insertions, 3 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
index ca54721..163efaa 100644
--- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
@@ -1044,8 +1044,40 @@ namespace OpenSim.Region.PhysicsModule.BulletS
1044 List<ContactResult> ret = new List<ContactResult>(); 1044 List<ContactResult> ret = new List<ContactResult>();
1045 if (BSParam.UseBulletRaycast) 1045 if (BSParam.UseBulletRaycast)
1046 { 1046 {
1047 DetailLog("{0},RaycastWorld,pos={1},dir={2},len={3},count={4},filter={5}", 1047 uint collisionFilter = 0;
1048 DetailLogZero, position, direction, length, count, filter); 1048 uint collisionMask = 0;
1049 if ((filter & RayFilterFlags.land) != 0)
1050 {
1051 collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.Terrain].group;
1052 collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.Terrain].mask;
1053 }
1054 if ((filter & RayFilterFlags.agent) != 0)
1055 {
1056 collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.Avatar].group;
1057 collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.Avatar].mask;
1058 }
1059 if ((filter & RayFilterFlags.nonphysical) != 0)
1060 {
1061 collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.Static].group;
1062 collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.Static].mask;
1063 }
1064 if ((filter & RayFilterFlags.physical) != 0)
1065 {
1066 collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.Dynamic].group;
1067 collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.Dynamic].mask;
1068 }
1069 // if ((filter & RayFilterFlags.phantom) != 0)
1070 // {
1071 // collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.VolumeDetect].group;
1072 // collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.VolumeDetect].mask;
1073 // }
1074 if ((filter & RayFilterFlags.volumedtc) != 0)
1075 {
1076 collisionFilter |= BulletSimData.CollisionTypeMasks[CollisionType.VolumeDetect].group;
1077 collisionMask |= BulletSimData.CollisionTypeMasks[CollisionType.VolumeDetect].mask;
1078 }
1079 DetailLog("{0},RaycastWorld,pos={1},dir={2},len={3},count={4},filter={5},filter={6},mask={7}",
1080 DetailLogZero, position, direction, length, count, filter, collisionFilter, collisionMask);
1049 // NOTE: locking ensures the physics engine is not executing. 1081 // NOTE: locking ensures the physics engine is not executing.
1050 // The caller might have to wait for the physics engine to finish. 1082 // The caller might have to wait for the physics engine to finish.
1051 lock (PhysicsEngineLock) 1083 lock (PhysicsEngineLock)
@@ -1054,7 +1086,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
1054 Vector3 posTo = Vector3.Normalize(direction) * length + position; 1086 Vector3 posTo = Vector3.Normalize(direction) * length + position;
1055 DetailLog("{0},RaycastWorld,RayTest2,from={1},to={2}", 1087 DetailLog("{0},RaycastWorld,RayTest2,from={1},to={2}",
1056 DetailLogZero, posFrom, posTo); 1088 DetailLogZero, posFrom, posTo);
1057 RaycastHit hitInfo = PE.RayTest2(World, posFrom, posTo, 0xffff, 0xffff); 1089 RaycastHit hitInfo = PE.RayTest2(World, posFrom, posTo, collisionFilter, collisionMask);
1058 if (hitInfo.hasHit()) 1090 if (hitInfo.hasHit())
1059 { 1091 {
1060 ContactResult result = new ContactResult(); 1092 ContactResult result = new ContactResult();