Show / Hide Table of Contents

    Class BaseCollider

    Inheritance
    System.Object
    BaseCollider
    BoxCollider3D
    CapsuleCollider3D
    CylinderCollider3D
    InfinitePlaneCollider3D
    MeshCollider3D
    SphereCollider3D
    Namespace: Motphys.Rigidbody
    Assembly: solution.dll
    Syntax
    public abstract class BaseCollider : MonoBehaviour

    Properties

    attachedRigidbody

    Declaration
    public Rigidbody3D attachedRigidbody { get; }
    Property Value
    Type Description
    Rigidbody3D

    The rigidbody this collider attached.

    collisionMask

    Declaration
    public CollisionMask collisionMask { get; }
    Property Value
    Type Description
    CollisionMask

    The collision mask of the collider.

    contactOffset

    Declaration
    public float contactOffset { get; set; }
    Property Value
    Type Description
    System.Single

    The speculative margin of the collider. Used to control how far of the distance between two colliders will be considered a collision.

    Exceptions
    Type Condition
    System.ArgumentException

    separationOffset must be less than contactOffset

    isTrigger

    Declaration
    public bool isTrigger { get; set; }
    Property Value
    Type Description
    System.Boolean

    Whether the collider is a trigger.

    material

    Declaration
    public PhysicMaterial material { get; set; }
    Property Value
    Type Description
    PhysicMaterial

    The physic material used by the collider. If material is shared by colliders, it will duplicate the material and assign it to the collider.

    separationOffset

    Declaration
    public float separationOffset { get; set; }
    Property Value
    Type Description
    System.Single

    The actual separation bound offset of the collider.

    Exceptions
    Type Condition
    System.ArgumentException

    separationOffset must be less than contactOffset

    shapeRotation

    Declaration
    public Quaternion shapeRotation { get; set; }
    Property Value
    Type Description
    Quaternion

    The collider shape's local rotation in gameObject's local space

    shapeToWorldMatrix

    Declaration
    public Matrix4x4 shapeToWorldMatrix { get; }
    Property Value
    Type Description
    Matrix4x4

    The matrix that transforms a point from collider shape's local space to world space.

    Node: In renderer,if you have a parent transform with scale and a child that is arbitrarily rotated, it's scale will be skewed.

    However in physics world, we should keep the shape rigid and it should not be skewed.

    shapeTranslation

    Declaration
    public Vector3 shapeTranslation { get; set; }
    Property Value
    Type Description
    Vector3

    The collider shape's translation in gameObject's local space

    sharedMaterial

    Declaration
    public PhysicMaterial sharedMaterial { get; set; }
    Property Value
    Type Description
    PhysicMaterial

    shared material may be shared by multiple colliders. If we changed the property of the shared material, all related colliders will be affected.

    Use material property if you want to change for a single collider.

    See Also
    material

    supportDynamicScale

    Declaration
    public bool supportDynamicScale { get; set; }
    Property Value
    Type Description
    System.Boolean

    Whether automatically update shape size when transform scale changed.

    Has little performance impact. Enable it only when you really need it.

    Methods

    Update()

    Declaration
    protected void Update()

    Events

    onCollisionEnter

    OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. This event is only raised when the collider's trigger option is off.

    Declaration
    public event Action<Collision> onCollisionEnter
    Event Type
    Type Description
    System.Action<Collision>

    onCollisionExit

    OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. This event is only raised when the collider's trigger option is off.

    Declaration
    public event Action<Collision> onCollisionExit
    Event Type
    Type Description
    System.Action<Collision>

    onCollisionStay

    OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. This event is only raised when the collider's trigger option is off.

    Declaration
    public event Action<Collision> onCollisionStay
    Event Type
    Type Description
    System.Action<Collision>

    onTriggerEnter

    OnTriggerEnter is called when the Collider other enters the trigger. This event is only raised when the collider's trigger option is on.

    Declaration
    public event Action<BaseCollider> onTriggerEnter
    Event Type
    Type Description
    System.Action<BaseCollider>

    onTriggerExit

    OnTriggerExit is called when the Collider other has stopped touching the trigger. This event is only raised when the collider's trigger option is on.

    Declaration
    public event Action<BaseCollider> onTriggerExit
    Event Type
    Type Description
    System.Action<BaseCollider>

    onTriggerStay

    OnTriggerStay is called once per frame for every Collider other that is touching the trigger. This event is only raised when the collider's trigger option is on.

    Declaration
    public event Action<BaseCollider> onTriggerStay
    Event Type
    Type Description
    System.Action<BaseCollider>
    Back to top Copyright © 2020-2024 北京谋先飞技术有限公司及其关联公司北京谋先飞科技有限公司
    Generated by DocFX