Search Unity

Question How to make concave mesh work as a trigger?

Discussion in 'Physics' started by Max-0, Dec 28, 2023.

  1. Max-0

    Max-0

    Joined:
    Jun 10, 2021
    Posts:
    32
    Hello everyone!

    I have a laser mesh that is generated by a script, and I want to detect when an object passes into the laser, so I can have it take damage and cut off the laser; I want objects to pass through the laser.
    However, it seems as triggers only work for convex meshes.
    Any way to do this?

    upload_2023-12-27_19-16-13.png
     
  2. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    92
    Can you use capsule colliders for your lasers? Or raycasts?
     
  3. Max-0

    Max-0

    Joined:
    Jun 10, 2021
    Posts:
    32
    I decided to use raycasts instead, thanks for the help!
     
    codebiscuits likes this.
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,439
    Raycast is best for a laser-vs-object anyway. However, keep in mind you can make an object with multiple simpler convex colliders that approximate a concave shape.