Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Switching Rigidbodies isKinematic property triggers collisions... any workarounds?

Discussion in 'Physics' started by LB_Chris, Sep 3, 2020.

  1. LB_Chris

    LB_Chris

    Joined:
    Jan 29, 2020
    Posts:
    33
    Hey folks,

    I noticed that when I change the 'isKinematic' property a GameObject with a Rigidbody attached to it and some colliders on that GameObject or its hierarchy, then it will trigger collisions, which cause problems and I am currently looking for a workaround for it.

    To be more precise, in my case I have said kinematic ridgidbody collider within another static trigger collider. Once I disable the isKinematic property of the kinematic rigidbody via script, then within the same frame the OnTriggerExit and OnTriggerEnter is called on both colliders (in that order).

    To me that seems rather unintuitive since the rigidbody collider never exits nor enters the static trigger collider in said frame. Has anyone expierienced the same behaviour or can give me insight on why that is the case and/or why that is the wanted behaviour?

    Does anyone know a workaround to disable the calls of exactly those two calls? I could just tell the script to ignore the next OnTriggerExit and OnTriggerEnter but I would like to have a more solid approach.
     
    scionious likes this.
  2. ArshakKroyan

    ArshakKroyan

    Joined:
    Mar 4, 2015
    Posts:
    32
  3. stechmann

    stechmann

    Joined:
    Feb 24, 2012
    Posts:
    34