Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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.