Search Results for

    Show / Hide Table of Contents

    Class Collider

    A base class for all colliders.

    Inheritance
    System.Object
    Object
    SceneObject
    Actor
    PhysicsColliderActor
    Collider
    BoxCollider
    CapsuleCollider
    CharacterController
    MeshCollider
    SphereCollider
    SplineCollider
    Implements
    ISerializable
    Inherited Members
    PhysicsColliderActor.OnCollisionEnter(Collision)
    PhysicsColliderActor.OnCollisionExit(Collision)
    PhysicsColliderActor.OnTriggerEnter(PhysicsColliderActor)
    PhysicsColliderActor.OnTriggerExit(PhysicsColliderActor)
    PhysicsColliderActor.AttachedRigidBody
    PhysicsColliderActor.CollisionEnter
    PhysicsColliderActor.CollisionExit
    PhysicsColliderActor.TriggerEnter
    PhysicsColliderActor.TriggerExit
    Actor.HasTag()
    Actor.HasTag(String)
    Actor.SetParent(Actor, Boolean, Boolean)
    Actor.GetChild(Int32)
    Actor.GetChild(String)
    Actor.GetChild(Type)
    Actor.GetChildren(Type)
    Actor.GetScript(Int32)
    Actor.GetScript(Type)
    Actor.GetScripts(Type)
    Actor.AddMovement(Vector3)
    Actor.AddMovement(Vector3, Quaternion)
    Actor.GetWorldToLocalMatrix(Matrix)
    Actor.GetLocalToWorldMatrix(Matrix)
    Actor.FindActor(String)
    Actor.FindActor(Type)
    Actor.FindScript(Type)
    Actor.HasActorInHierarchy(Actor)
    Actor.HasActorInChildren(Actor)
    Actor.IntersectsItself(Ray, Single, Vector3)
    Actor.Intersects(Ray, Single, Vector3)
    Actor.LookAt(Vector3)
    Actor.LookAt(Vector3, Vector3)
    Actor.LookingAt(Vector3)
    Actor.LookingAt(Vector3, Vector3)
    Actor.ToBytes(Actor[])
    Actor.FromBytes(Byte[])
    Actor.FromBytes(Byte[], Dictionary<Guid, Guid>)
    Actor.TryGetSerializedObjectsIds(Byte[])
    Actor.ToJson()
    Actor.FromJson(String)
    Actor.OnBeginPlay()
    Actor.OnEndPlay()
    Actor.AddStaticFlags(StaticFlags)
    Actor.RemoveStaticFlags(StaticFlags)
    Actor.SetStaticFlag(StaticFlags, Boolean)
    Actor.HasStaticFlag(StaticFlags)
    Actor.ResetLocalTransform()
    Actor.AddChild(Type)
    Actor.AddChild<T>()
    Actor.GetChild<T>()
    Actor.TryGetChild<T>(T)
    Actor.GetOrAddChild<T>()
    Actor.AddScript(Type)
    Actor.AddScript<T>()
    Actor.GetScript<T>()
    Actor.TryGetScript<T>(T)
    Actor.FindScript<T>()
    Actor.FindActor<T>()
    Actor.GetChildren<T>()
    Actor.GetScripts<T>()
    Actor.DestroyChildren(Single)
    Actor.RotateAround(Vector3, Vector3, Single)
    Actor.ToString()
    Actor.Children
    Actor.Scripts
    Actor.HideFlags
    Actor.Layer
    Actor.LayerName
    Actor.Tag
    Actor.Name
    Actor.Scene
    Actor.ChildrenCount
    Actor.ScriptsCount
    Actor.IsActive
    Actor.IsActiveInHierarchy
    Actor.StaticFlags
    Actor.Transform
    Actor.Position
    Actor.Orientation
    Actor.Scale
    Actor.Rotation
    Actor.PerInstanceRandom
    Actor.Direction
    Actor.LocalTransform
    Actor.LocalPosition
    Actor.LocalOrientation
    Actor.LocalScale
    Actor.Sphere
    Actor.Box
    Actor.BoxWithChildren
    Actor.EditorBox
    Actor.EditorBoxChildren
    Actor.HasContentLoaded
    Actor.IsPrefabRoot
    Actor.PhysicsScene
    Actor.IsStatic
    Actor.IsTransformStatic
    Actor.EulerAngles
    Actor.LocalEulerAngles
    Actor.HasChildren
    Actor.WorldToLocalMatrix
    Actor.LocalToWorldMatrix
    SceneObject.SetParent(Actor, Boolean)
    SceneObject.LinkPrefab(Guid, Guid)
    SceneObject.BreakPrefabLink()
    SceneObject.GetNamePath(Char)
    SceneObject.HasParent
    SceneObject.Parent
    SceneObject.OrderInParent
    SceneObject.HasPrefabLink
    SceneObject.PrefabID
    SceneObject.PrefabObjectID
    Object.__unmanagedPtr
    Object.__internalId
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.New<T>()
    Object.New(Type)
    Object.Find<T>(Guid)
    Object.Find(Guid, Type)
    Object.TryFind<T>(Guid)
    Object.Destroy(Object, Single)
    Object.Destroy<T>(T, Single)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public abstract class Collider : PhysicsColliderActor, ISerializable

    Constructors

    Collider()

    Initializes a new instance of the Collider.

    Declaration
    protected Collider()

    Properties

    Center

    Gets or sets the center of the collider, measured in the object's local space.

    Declaration
    [EditorOrder(10)]
    [EditorDisplay("Collider", null)]
    [Unmanaged]
    public Vector3 Center { get; set; }
    Property Value
    Vector3

    ContactOffset

    Gets or sets the contact offset.

    Declaration
    [EditorOrder(1)]
    [Limit(0F, 100F, 1F)]
    [EditorDisplay("Collider", null)]
    [Unmanaged]
    public float ContactOffset { get; set; }
    Property Value
    System.Single

    Remarks

    Colliders whose distance is less than the sum of their ContactOffset values will generate contacts. The contact offset must be positive. Contact offset allows the collision detection system to predictively enforce the contact constraint even when the objects are slightly separated.

    IsTrigger

    Gets or sets the 'IsTrigger' flag.

    Declaration
    [EditorOrder(0)]
    [EditorDisplay("Collider", null)]
    [Unmanaged]
    public bool IsTrigger { get; set; }
    Property Value
    System.Boolean

    Remarks

    A trigger doesn't register a collision with an incoming Rigidbody. Instead, it sends OnTriggerEnter, OnTriggerExit and OnTriggerStay message when a rigidbody enters or exits the trigger volume.

    Material

    The physical material used to define the collider physical properties.

    Declaration
    [EditorOrder(2)]
    [AssetReference(typeof(PhysicalMaterial), true)]
    [EditorDisplay("Collider", null)]
    [Unmanaged]
    public JsonAsset Material { get; set; }
    Property Value
    JsonAsset

    Methods

    ClosestPoint(Vector3, out Vector3)

    Gets a point on the collider that is closest to a given location. Can be used to find a hit location or position to apply explosion force or any other special effects.

    Declaration
    [Unmanaged]
    public void ClosestPoint(Vector3 point, out Vector3 result)
    Parameters
    Vector3 point

    The position to find the closest point to it.

    Vector3 result

    The result point on the collider that is closest to the specified location.

    ComputePenetration(Collider, Collider, out Vector3, out Single)

    Computes minimum translational distance between two geometry objects. Translating the first collider by direction * distance will separate the colliders apart if the function returned true. Otherwise, direction and distance are not defined. The one of the colliders has to be BoxCollider, SphereCollider CapsuleCollider or a convex MeshCollider. The other one can be any type. If objects do not overlap, the function can not compute the distance and returns false.

    Declaration
    [Unmanaged]
    public static bool ComputePenetration(Collider colliderA, Collider colliderB, out Vector3 direction, out float distance)
    Parameters
    Collider colliderA

    The first collider.

    Collider colliderB

    The second collider.

    Vector3 direction

    The computed direction along which the translation required to separate the colliders apart is minimal. Valid only if function returns true.

    System.Single distance

    The penetration distance along direction that is required to separate the colliders apart. Valid only if function returns true.

    Returns
    System.Boolean

    True if the distance has successfully been computed, i.e. if objects do overlap, otherwise false.

    ContainsPoint(Vector3)

    Checks if a point is inside the collider.

    Declaration
    [Unmanaged]
    public bool ContainsPoint(Vector3 point)
    Parameters
    Vector3 point

    The point to check if is contained by the collider shape (in world-space).

    Returns
    System.Boolean

    True if collider shape contains a given point, otherwise false.

    RayCast(Vector3, Vector3, out RayCastHit, Single)

    Performs a raycast against this collider, returns results in a RaycastHit structure.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F)
    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.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    RayCast(Vector3, Vector3, out Single, Single)

    Performs a raycast against this collider shape.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out float resultHitDistance, float maxDistance = 3.40282347E+38F)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    System.Single resultHitDistance

    The raycast result hit position distance from the ray origin. Valid only if raycast hits anything.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)

    See Also

    Actor
    PhysicsColliderActor
    In This Article
    Back to top Copyright © 2012-2021 Wojciech Figat