Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Move pivot of object dynamically based on closest point to nearest mesh

Discussion in 'Scripting' started by adamTim, Dec 12, 2021.

  1. adamTim


    Oct 18, 2020
    Hi I'm currently struggling to figure out how to approach this problem. Basically, the player has the ability to duplicate or cut objects from the world and instantiate them elsewhere. The issue happens with collision checking whereas the new spawned mesh is spawned inside another one, instead of being spawned on it/touching it. I figured out this must have something to do with the pivot point location within the mesh, but I'm no sure of how to implement the fix, I tried googling some solutions but none of the existing ones seemed to work or help this case.