- Home /
Subtract the object when collides with other object
I have two objects ...
-one is not moving and other is moving...
I want to subtract the area of stable object where both collides
Answer by UnityedWeStand · Jul 04, 2020 at 08:10 PM
What you are describing is known as a "boolean operation" on a mesh, which includes subtracting one mesh from another in the area they intersect. Unity does not support this natively, and trying to do precise boolean operations in real time is very expensive in terms of performance.
I'm not familiar with any custom packages out there that do this, but you could search on the asset store for "CSG" tools or "boolean mesh" tools.
Exactly i want this...But that removes larger constant area from object now i need to customize it...Thanks Alot!
Answer by cm_2303 · Jul 04, 2020 at 01:10 PM
You can use destroy to remove an object
I dont want to remove an object completely .. but i want to remove only the place where it collides
You can just disable the renderer on the object during collision, if so use this:
GetComponent().enabled = !GetComponent().enabled;
You can also use the SetActive command like this:
myGameObject.SetActive(false); //myGameObject = GameObject var