docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct CollisionFilter

    Describes which other objects an object can collide with.

    Implements
    IEquatable<CollisionFilter>
    Inherited Members
    ValueType.Equals(object)
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Physics
    Assembly: Unity.Physics.dll
    Syntax
    public struct CollisionFilter : IEquatable<CollisionFilter>

    Fields

    BelongsTo

    A bit mask describing which layers this object belongs to.

    Declaration
    public uint BelongsTo
    Field Value
    Type Description
    uint

    CollidesWith

    A bit mask describing which layers this object can collide with.

    Declaration
    public uint CollidesWith
    Field Value
    Type Description
    uint

    Default

    (Immutable) A collision filter which wants to collide with everything.

    Declaration
    public static readonly CollisionFilter Default
    Field Value
    Type Description
    CollisionFilter

    GroupIndex

    An optional override for the bit mask checks. If the value in both objects is equal and positive, the objects always collide. If the value in both objects is equal and negative, the objects never collide.

    Declaration
    public int GroupIndex
    Field Value
    Type Description
    int

    Zero

    (Immutable) A collision filter which never collides with against anything (including Default).

    Declaration
    public static readonly CollisionFilter Zero
    Field Value
    Type Description
    CollisionFilter

    Properties

    IsEmpty

    Returns true if the filter cannot collide with anything, which likely means it was default constructed but not initialized.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    True if this object is empty, false if not.

    Methods

    CreateUnion(CollisionFilter, CollisionFilter)

    Return a union of two filters.

    Declaration
    public static CollisionFilter CreateUnion(CollisionFilter filterA, CollisionFilter filterB)
    Parameters
    Type Name Description
    CollisionFilter filterA

    The filter a.

    CollisionFilter filterB

    The filter b.

    Returns
    Type Description
    CollisionFilter

    The new union.

    Equals(CollisionFilter)

    Tests if this CollisionFilter is considered equal to another.

    Declaration
    public bool Equals(CollisionFilter other)
    Parameters
    Type Name Description
    CollisionFilter other

    The collision filter to compare to this object.

    Returns
    Type Description
    bool

    True if the objects are considered equal, false if they are not.

    GetHashCode()

    Calculates a hash code for this object.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for this object.

    Overrides
    ValueType.GetHashCode()

    IsCollisionEnabled(CollisionFilter, CollisionFilter)

    Return true if the given pair of filters want to collide with each other.

    Declaration
    public static bool IsCollisionEnabled(CollisionFilter filterA, CollisionFilter filterB)
    Parameters
    Type Name Description
    CollisionFilter filterA

    The filter a.

    CollisionFilter filterB

    The filter b.

    Returns
    Type Description
    bool

    True if the collision is enabled, false if not.

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)