Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to populate Collision class data

Discussion in 'Physics' started by sstrong, Nov 25, 2020.

  1. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,219
    I have a Kinematic rigidbody controller and would like to send Collision data with OnCollisionEnter to overlapping colliders that have been discovered with Physics.OverlapCapsuleNonAlloc(). This means I need to send Collision as a parameter, however, Collision class members are read-only properties.

    Is there any way to populate a new class instance?
    Code (CSharp):
    1. Collision collision = new Collision()
    2. {
    3.  
    4. };