diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/BulletS/BSScene.cs | 92 |
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; |