Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Smooth collision normals?

Discussion in 'Physics' started by DinkyDev, Mar 15, 2017.

  1. DinkyDev

    DinkyDev

    Joined:
    Jan 14, 2014
    Posts:
    29
    Hello,

    I'm looking at making a golf game, but having looked into the physics side of it, I'm hitting an issue related to collision normals. This is in 3D and the course will be made out of a fairly smooth mesh. The issue is that for the physics update the normals are per-triangle, and not smoothed. This is highlighted in a video posted by another user comparing the normals returned by physics collisions for both a hard-edged mesh and a smooth shaded mesh (note the red normals match despite one being smooth).



    What I'm after is smooth, interpolated normals during collision:



    There's two aspects to this:

    1. Is there a way of getting smooth normals, so that regardless of how detailed the mesh is, it still generates smooth normals across a triangle if it's vertices have unique normals?

    2. Unity still hasn't exposed contact modification during the PhysX update. If this was possible then on contact, I could look up the correct, smooth normal from my own data for that contact location.

    Does anybody have any information on either of the above two points? Or does anybody know of another way to solve this?
     
  2. Sunigames

    Sunigames

    Joined:
    Oct 17, 2016
    Posts:
    1
    I used turbo smooth models for this. Unfortunately with low polygon counts we got bouncing sphere in Unity :( Even on surfaces looking smooth, the ball started to bounce, especialy when we moved them by forces.
     
  3. DinkyDev

    DinkyDev

    Joined:
    Jan 14, 2014
    Posts:
    29
    I think this is all solvable with Unity Physics now. Since we can get a callback during the actual collision response, that allows us to modify the collision data, including the normals, so we could calculate the smooth normal ourselves.