Ejemplo n.º 1
0
 private static extern bool Internal_SphereOverlapAny(ref Sphere sphere, ulong layer);
Ejemplo n.º 2
0
 private static extern bool Internal_SphereCastAny(ref Sphere sphere, ref Vector3 unitDir, ulong layer,  float max);
Ejemplo n.º 3
0
 private static extern NativeCollider[] Internal_SphereOverlap(ref Sphere sphere, ulong layer);
Ejemplo n.º 4
0
 private static extern bool Internal_SphereCast(ref Sphere sphere, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max);
Ejemplo n.º 5
0
 private static extern ScriptPhysicsQueryHit[] Internal_SphereCastAll(ref Sphere sphere, ref Vector3 unitDir, ulong layer, float max);
Ejemplo n.º 6
0
 /// <summary>
 /// Returns a list of all colliders in the scene that overlap the provided sphere.
 /// </summary>
 /// <param name="sphere">Sphere to check for overlap.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
 ///                     </param>
 /// <returns>List of all colliders that overlap the sphere.</returns>
 public static Collider[] SphereOverlap(Sphere sphere, ulong layer = ulong.MaxValue)
 {
     return ConvertColliders(Internal_SphereOverlap(ref sphere, layer));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Checks if the provided sphere overlaps any other collider in the scene.
 /// </summary>
 /// <param name="sphere">Sphere to check for overlap.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
 ///                     </param>
 /// <returns>True if there is overlap with another object, false otherwise.</returns>
 public static bool SphereOverlapAny(Sphere sphere, ulong layer = ulong.MaxValue)
 {
     return Internal_SphereOverlapAny(ref sphere, layer);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Performs a sweep into the scene using a sphere and returns all found hits.
 /// </summary>
 /// <param name="sphere">Sphere to sweep through the scene.</param>
 /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
 ///                     </param>
 /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
 ///                   </param>
 /// <returns>List of all detected hits.</returns>
 public static PhysicsQueryHit[] SphereCastAll(Sphere sphere, Vector3 unitDir,
     ulong layer = ulong.MaxValue, float max = float.MaxValue)
 {
     return ConvertPhysicsQueryHits(Internal_SphereCastAll(ref sphere, ref unitDir, layer, max));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Performs a sweep into the scene using a sphere and checks if it has hit anything. This can be significantly more
 /// efficient than other types of cast* calls.
 /// </summary>
 /// <param name="sphere">Sphere to sweep through the scene.</param>
 /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
 ///                     </param>
 /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
 ///                   </param>
 /// <returns>True if something was hit, false otherwise.</returns>
 public static bool SphereCastAny(Sphere sphere, Vector3 unitDir, ulong layer = ulong.MaxValue, 
     float max = float.MaxValue)
 {
     return Internal_SphereCastAny(ref sphere, ref unitDir, layer, max);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Performs a sweep into the scene using a sphere and returns the closest found hit, if any.
        /// </summary>
        /// <param name="sphere">Sphere to sweep through the scene.</param>
        /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
        /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
        ///                   </param>
        /// <returns>True if something was hit, false otherwise.</returns>
        public static bool SphereCast(Sphere sphere, Vector3 unitDir, out PhysicsQueryHit hit,
            ulong layer = ulong.MaxValue, float max = float.MaxValue)
        {
            ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit();
            if(Internal_SphereCast(ref sphere, ref unitDir, out scriptHit, layer, max))
            {
                ConvertPhysicsQueryHit(ref scriptHit, out hit);
                return true;
            }

            hit = new PhysicsQueryHit();
            return false;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Calculates bounds of the visible content for this component.
        /// </summary>
        /// <param name="box">Bounds in world space represented as an axis aligned bounding box.</param>
        /// <param name="sphere">Bounds in world space represented as a sphere.</param>
        /// <returns>True if the bounds have non-zero volume, false otherwise.</returns>
        protected internal virtual bool CalculateBounds(out AABox box, out Sphere sphere)
        {
            Vector3 pos = SceneObject.Position;

            box = new AABox(pos, pos);
            sphere = new Sphere(pos, 0.0f);

            return false;
        }
Ejemplo n.º 12
0
 private static extern void Internal_GetBounds(IntPtr thisPtr, IntPtr parentSO, out AABox box, out Sphere sphere);
Ejemplo n.º 13
0
        /// <inheritdoc/>
        protected internal override bool CalculateBounds(out AABox box, out Sphere sphere)
        {
            Bounds bounds = Bounds;

            box = bounds.Box;
            sphere = bounds.Sphere;

            return true;
        }
Ejemplo n.º 14
0
 private static extern void Internal_GetBounds(IntPtr thisPtr, IntPtr parentSO, out AABox box, out Sphere sphere);