Search Results for

    Show / Hide Table of Contents

    Class Physics

    Physics simulation system.

    Inheritance
    System.Object
    Physics
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public static class Physics : Object

    Properties

    AutoSimulation

    The automatic simulation feature. True if perform physics simulation after on fixed update by auto, otherwise user should do it.

    Declaration
    [Unmanaged]
    public static bool AutoSimulation { get; }
    Property Value
    System.Boolean

    BounceThresholdVelocity

    Gets or sets the minimum relative velocity required for an object to bounce.

    Declaration
    [Unmanaged]
    public static float BounceThresholdVelocity { get; set; }
    Property Value
    System.Single

    DefaultScene

    The default physics scene.

    Declaration
    [Unmanaged]
    public static PhysicsScene DefaultScene { get; }
    Property Value
    PhysicsScene

    EnableCCD

    Gets or sets the CCD feature enable flag.

    Declaration
    [Unmanaged]
    public static bool EnableCCD { get; set; }
    Property Value
    System.Boolean

    Gravity

    Gets or sets the current gravity force.

    Declaration
    [DebugCommand]
    [Unmanaged]
    public static Vector3 Gravity { get; set; }
    Property Value
    Vector3

    IsDuringSimulation

    Checks if physical simulation is running.

    Declaration
    [Unmanaged]
    public static bool IsDuringSimulation { get; }
    Property Value
    System.Boolean

    Scenes

    List with all physics scenes (readonly).

    Declaration
    [Unmanaged]
    public static PhysicsScene[] Scenes { get; }
    Property Value
    PhysicsScene[]

    Methods

    BoxCast(Vector3, Vector3, Vector3, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a box geometry.

    Declaration
    [Unmanaged]
    public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    Vector3 direction

    The normalized direction in which cast a box.

    Quaternion rotation

    The box rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box hits an matching object, otherwise false.

    BoxCast(Vector3, Vector3, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a box geometry.

    Declaration
    [Unmanaged]
    public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    Vector3 direction

    The normalized direction in which cast a box.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    Quaternion rotation

    The box rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box hits an matching object, otherwise false.

    BoxCastAll(Vector3, Vector3, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a box geometry.

    Declaration
    [Unmanaged]
    public static bool BoxCastAll(Vector3 center, Vector3 halfExtents, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    Vector3 direction

    The normalized direction in which cast a box.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    Quaternion rotation

    The box rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box hits an matching object, otherwise false.

    CapsuleCast(Vector3, Single, Single, Vector3, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a capsule geometry.

    Declaration
    [Unmanaged]
    public static bool CapsuleCast(Vector3 center, float radius, float height, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    Vector3 direction

    The normalized direction in which cast a capsule.

    Quaternion rotation

    The capsule rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule hits an matching object, otherwise false.

    CapsuleCast(Vector3, Single, Single, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a capsule geometry.

    Declaration
    [Unmanaged]
    public static bool CapsuleCast(Vector3 center, float radius, float height, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    Vector3 direction

    The normalized direction in which cast a capsule.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    Quaternion rotation

    The capsule rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule hits an matching object, otherwise false.

    CapsuleCastAll(Vector3, Single, Single, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a capsule geometry.

    Declaration
    [Unmanaged]
    public static bool CapsuleCastAll(Vector3 center, float radius, float height, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    Vector3 direction

    The normalized direction in which cast a capsule.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    Quaternion rotation

    The capsule rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule hits an matching object, otherwise false.

    CheckBox(Vector3, Vector3, Quaternion, UInt32, Boolean)

    Checks whether the given box overlaps with other colliders or not.

    Declaration
    [Unmanaged]
    public static bool CheckBox(Vector3 center, Vector3 halfExtents, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    Quaternion rotation

    The box rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box overlaps any matching object, otherwise false.

    CheckCapsule(Vector3, Single, Single, Quaternion, UInt32, Boolean)

    Checks whether the given capsule overlaps with other colliders or not.

    Declaration
    [Unmanaged]
    public static bool CheckCapsule(Vector3 center, float radius, float height, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    Quaternion rotation

    The capsule rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule overlaps any matching object, otherwise false.

    CheckConvex(Vector3, CollisionData, Vector3, Quaternion, UInt32, Boolean)

    Checks whether the given convex mesh overlaps with other colliders or not.

    Declaration
    [Unmanaged]
    public static bool CheckConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    Quaternion rotation

    The convex mesh rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh overlaps any matching object, otherwise false.

    CheckSphere(Vector3, Single, UInt32, Boolean)

    Checks whether the given sphere overlaps with other colliders or not.

    Declaration
    [Unmanaged]
    public static bool CheckSphere(Vector3 center, float radius, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere overlaps any matching object, otherwise false.

    CollectResults()

    Called during main engine loop to collect physic simulation results and apply them as well as fire collision events.

    Declaration
    [Unmanaged]
    public static void CollectResults()

    ConvexCast(Vector3, CollisionData, Vector3, Vector3, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a convex mesh.

    Declaration
    [Unmanaged]
    public static bool ConvexCast(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    Vector3 direction

    The normalized direction in which cast a convex mesh.

    Quaternion rotation

    The convex mesh rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh hits an matching object, otherwise false.

    ConvexCast(Vector3, CollisionData, Vector3, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a convex mesh.

    Declaration
    [Unmanaged]
    public static bool ConvexCast(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    Vector3 direction

    The normalized direction in which cast a convex mesh.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    Quaternion rotation

    The convex mesh rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh hits an matching object, otherwise false.

    ConvexCastAll(Vector3, CollisionData, Vector3, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a convex mesh.

    Declaration
    [Unmanaged]
    public static bool ConvexCastAll(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    Vector3 direction

    The normalized direction in which cast a convex mesh.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    Quaternion rotation

    The convex mesh rotation.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh hits an matching object, otherwise false.

    FindOrCreateScene(String)

    Finds an existing PhysicsScene or creates it if it does not exist.

    Declaration
    [Unmanaged]
    public static PhysicsScene FindOrCreateScene(string name)
    Parameters
    System.String name

    Returns
    PhysicsScene

    FindScene(String)

    Finds an existing scene.

    Declaration
    [Unmanaged]
    public static PhysicsScene FindScene(string name)
    Parameters
    System.String name

    Returns
    PhysicsScene

    FlushRequests()

    Flushes any latent physics actions (eg. object destroy, actor add/remove to the scene, etc.).

    Declaration
    [Unmanaged]
    public static void FlushRequests()

    LineCast(Vector3, Vector3, out RayCastHit, UInt32, Boolean)

    Performs a line between two points in the scene.

    Declaration
    [Unmanaged]
    public static bool LineCast(Vector3 start, Vector3 end, out RayCastHit hitInfo, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 start

    The start position of the line.

    Vector3 end

    The end position of the line.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    LineCast(Vector3, Vector3, UInt32, Boolean)

    Performs a line between two points in the scene.

    Declaration
    [Unmanaged]
    public static bool LineCast(Vector3 start, Vector3 end, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 start

    The start position of the line.

    Vector3 end

    The end position of the line.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    LineCastAll(Vector3, Vector3, out RayCastHit[], UInt32, Boolean)

    Performs a line between two points in the scene, returns all hitpoints infos.

    Declaration
    [Unmanaged]
    public static bool LineCastAll(Vector3 start, Vector3 end, out RayCastHit[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 start

    The origin of the ray.

    Vector3 end

    The end position of the line.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    OverlapBox(Vector3, Vector3, out Collider[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given box.

    Declaration
    [Unmanaged]
    public static bool OverlapBox(Vector3 center, Vector3 halfExtents, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    Collider[] results

    The result colliders that overlap with the given box. Valid only when method returns true.

    Quaternion rotation

    The box rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box overlaps any matching object, otherwise false.

    OverlapBox(Vector3, Vector3, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given box.

    Declaration
    [Unmanaged]
    public static bool OverlapBox(Vector3 center, Vector3 halfExtents, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The box center.

    Vector3 halfExtents

    The half size of the box in each direction.

    PhysicsColliderActor[] results

    The result colliders that overlap with the given box. Valid only when method returns true.

    Quaternion rotation

    The box rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if box overlaps any matching object, otherwise false.

    OverlapCapsule(Vector3, Single, Single, out Collider[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given capsule.

    Declaration
    [Unmanaged]
    public static bool OverlapCapsule(Vector3 center, float radius, float height, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    Collider[] results

    The result colliders that overlap with the given capsule. Valid only when method returns true.

    Quaternion rotation

    The capsule rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule overlaps any matching object, otherwise false.

    OverlapCapsule(Vector3, Single, Single, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given capsule.

    Declaration
    [Unmanaged]
    public static bool OverlapCapsule(Vector3 center, float radius, float height, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The capsule center.

    System.Single radius

    The radius of the capsule.

    System.Single height

    The height of the capsule, excluding the top and bottom spheres.

    PhysicsColliderActor[] results

    The result colliders that overlap with the given capsule. Valid only when method returns true.

    Quaternion rotation

    The capsule rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if capsule overlaps any matching object, otherwise false.

    OverlapConvex(Vector3, CollisionData, Vector3, out Collider[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given convex mesh.

    Declaration
    [Unmanaged]
    public static bool OverlapConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    Collider[] results

    The result colliders that overlap with the given convex mesh. Valid only when method returns true.

    Quaternion rotation

    The convex mesh rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh overlaps any matching object, otherwise false.

    OverlapConvex(Vector3, CollisionData, Vector3, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)

    Finds all colliders touching or inside of the given convex mesh.

    Declaration
    [Unmanaged]
    public static bool OverlapConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The convex mesh center.

    CollisionData convexMesh

    Collision data of the convex mesh.

    Vector3 scale

    The scale of the convex mesh.

    PhysicsColliderActor[] results

    The result colliders that overlap with the given convex mesh. Valid only when method returns true.

    Quaternion rotation

    The convex mesh rotation.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if convex mesh overlaps any matching object, otherwise false.

    OverlapSphere(Vector3, Single, out Collider[], UInt32, Boolean)

    Finds all colliders touching or inside of the given sphere.

    Declaration
    [Unmanaged]
    public static bool OverlapSphere(Vector3 center, float radius, out Collider[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    Collider[] results

    The result colliders that overlap with the given sphere. Valid only when method returns true.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere overlaps any matching object, otherwise false.

    OverlapSphere(Vector3, Single, out PhysicsColliderActor[], UInt32, Boolean)

    Finds all colliders touching or inside of the given sphere.

    Declaration
    [Unmanaged]
    public static bool OverlapSphere(Vector3 center, float radius, out PhysicsColliderActor[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    PhysicsColliderActor[] results

    The result colliders that overlap with the given sphere. Valid only when method returns true.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere overlaps any matching object, otherwise false.

    RayCast(Vector3, Vector3, out RayCastHit, Single, UInt32, Boolean)

    Performs a raycast against objects in the scene, returns results in a RayCastHit structure.

    Declaration
    [Unmanaged]
    public static bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    RayCast(Vector3, Vector3, Single, UInt32, Boolean)

    Performs a raycast against objects in the scene.

    Declaration
    [Unmanaged]
    public static bool RayCast(Vector3 origin, Vector3 direction, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    RayCastAll(Vector3, Vector3, out RayCastHit[], Single, UInt32, Boolean)

    Performs a raycast against objects in the scene, returns results in a RayCastHit structure.

    Declaration
    [Unmanaged]
    public static bool RayCastAll(Vector3 origin, Vector3 direction, out RayCastHit[] results, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if ray hits an matching object, otherwise false.

    Simulate(Single)

    Called during main engine loop to start physic simulation. Use CollectResults after.

    Declaration
    [Unmanaged]
    public static void Simulate(float dt)
    Parameters
    System.Single dt

    The delta time (in seconds).

    SphereCast(Vector3, Single, Vector3, out RayCastHit, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a sphere geometry.

    Declaration
    [Unmanaged]
    public static bool SphereCast(Vector3 center, float radius, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    Vector3 direction

    The normalized direction in which cast a sphere.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere hits an matching object, otherwise false.

    SphereCast(Vector3, Single, Vector3, Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a sphere geometry.

    Declaration
    [Unmanaged]
    public static bool SphereCast(Vector3 center, float radius, Vector3 direction, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    Vector3 direction

    The normalized direction in which cast a sphere.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere hits an matching object, otherwise false.

    SphereCastAll(Vector3, Single, Vector3, out RayCastHit[], Single, UInt32, Boolean)

    Performs a sweep test against objects in the scene using a sphere geometry.

    Declaration
    [Unmanaged]
    public static bool SphereCastAll(Vector3 center, float radius, Vector3 direction, out RayCastHit[] results, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
    Parameters
    Vector3 center

    The sphere center.

    System.Single radius

    The radius of the sphere.

    Vector3 direction

    The normalized direction in which cast a sphere.

    RayCastHit[] results

    The result hits. Valid only when method returns true.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    System.UInt32 layerMask

    The layer mask used to filter the results.

    System.Boolean hitTriggers

    If set to true triggers will be hit, otherwise will skip them.

    Returns
    System.Boolean

    True if sphere hits an matching object, otherwise false.

    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat