aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2017-09-02 13:06:36 -0700
committerRobert Adams2017-09-02 13:06:36 -0700
commit0afa3a294ab36382cf720e9cceb9211a83fbf101 (patch)
tree5e5c1c62be9880052a2cab1a33055017d2d868bd /OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
parentfix cache.cs (used on parcels info) (diff)
downloadopensim-SC_OLD-0afa3a294ab36382cf720e9cceb9211a83fbf101.zip
opensim-SC_OLD-0afa3a294ab36382cf720e9cceb9211a83fbf101.tar.gz
opensim-SC_OLD-0afa3a294ab36382cf720e9cceb9211a83fbf101.tar.bz2
opensim-SC_OLD-0afa3a294ab36382cf720e9cceb9211a83fbf101.tar.xz
BulletSim: most of the plumbing for raycast. Needs new BulletSim.dll to
work.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSScene.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSScene.cs92
1 files changed, 92 insertions, 0 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
index 7ff0a07..f1ff3a9 100644
--- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
@@ -956,6 +956,98 @@ namespace OpenSim.Region.PhysicsModule.BulletS
956 956
957 #endregion // Terrain 957 #endregion // Terrain
958 958
959 #region Raycast
960
961 public override bool SupportsRayCast()
962 {
963 return BSParam.UseBulletRaycast;
964 }
965
966 public override bool SupportsRaycastWorldFiltered()
967 {
968 return BSParam.UseBulletRaycast;
969 }
970
971
972 /// <summary>
973 /// Queue a raycast against the physics scene.
974 /// The provided callback method will be called when the raycast is complete
975 ///
976 /// Many physics engines don't support collision testing at the same time as
977 /// manipulating the physics scene, so we queue the request up and callback
978 /// a custom method when the raycast is complete.
979 /// This allows physics engines that give an immediate result to callback immediately
980 /// and ones that don't, to callback when it gets a result back.
981 /// public delegate void RayCallback(List<ContactResult> list);
982 ///
983 /// ODE for example will not allow you to change the scene while collision testing or
984 /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene.
985 ///
986 /// This is named RayCastWorld to not conflict with modrex's Raycast method.
987 /// </summary>
988 /// <param name="position">Origin of the ray</param>
989 /// <param name="direction">Direction of the ray</param>
990 /// <param name="length">Length of ray in meters</param>
991 /// <param name="retMethod">Method to call when the raycast is complete</param>
992 public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
993 {
994 if (retMethod != null)
995 {
996 if (BSParam.UseBulletRaycast)
997 {
998 Vector3 posFrom = position;
999 Vector3 posTo = Vector3.Normalize(direction) * length + position;
1000
1001 TaintedObject(DetailLogZero, "BSScene.RaycastWorld1", delegate ()
1002 {
1003 RaycastHit hitInfo = PE.RayTest2(World, posFrom, posTo, 0xffff, 0xffff);
1004 retMethod(true, hitInfo.Point, hitInfo.ID, hitInfo.Fraction, hitInfo.Normal);
1005 });
1006 }
1007 else
1008 {
1009 retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
1010 }
1011 }
1012 }
1013
1014 public override void RaycastWorld(Vector3 position, Vector3 direction, float length, int count, RayCallback retMethod)
1015 {
1016 if (retMethod != null)
1017 {
1018 if (BSParam.UseBulletRaycast)
1019 {
1020 List<ContactResult> hitInfo = RaycastWorld(position, direction, length, count);
1021 retMethod(hitInfo);
1022 }
1023 else
1024 {
1025 retMethod(new List<ContactResult>());
1026 }
1027 }
1028 }
1029
1030 public override List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count)
1031 {
1032 List<ContactResult> ret = new List<ContactResult>();
1033 if (BSParam.UseBulletRaycast)
1034 {
1035 }
1036 return ret;
1037 }
1038
1039 public override object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
1040 {
1041 object ret = null;
1042 if (BSParam.UseBulletRaycast)
1043 {
1044 }
1045 return ret;
1046 }
1047
1048 #endregion Raycast
1049
1050
959 public override Dictionary<uint, float> GetTopColliders() 1051 public override Dictionary<uint, float> GetTopColliders()
960 { 1052 {
961 Dictionary<uint, float> topColliders; 1053 Dictionary<uint, float> topColliders;