Search Unity

关于2D项目碰撞问题

Discussion in '2D' started by Gushuman, Aug 4, 2019.

  1. Gushuman

    Gushuman

    Joined:
    Jul 27, 2019
    Posts:
    8
    两个物体我想检测是否发生碰撞,但是不让物体发生碰撞的运动(不位移,轨迹速度不变),然后销毁其中一个物体,但是OnCollisionEnter2D这个函数是碰撞运动大于检测的,虽然检测到了,但物体总会发生运动偏移,有没有只检测碰撞,但不发生运动的函数或者方法? 谢谢各位大佬!
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,496
    You can set a Collider2D to be a trigger which tells you which other Collider2D it contacts. If you need a ContactPoint2D then you'll need to use Rigidbody2D set to a body-type of Kinematic and use full kinematic contacts as I described in your previous post here.
     
    vakabaka likes this.