Impenetrable meshes when colliding happens?

Hi,

I’m implementing a simple system where the user can drag one object and touch another mesh then the system will detect that two meshes are touching. The collision event can be detected fine using a capsule collider, what may seem strange to the users is that one mesh can go through the other one when being dragged. Is it possible to make the mesh impenetrable? ie. when the colliding event happens, stop the mesh from going through another mesh?

Thanks in advance!!

If the colliders are relatively small or fast moving you might need:
Rigidbody > Collision Detection > Continuous

If the colliders aren’t colliding at all you’ll need at least one to have a rigidbody and neither should be a trigger.

thanks for the reply. I just tried what you suggested, I can still drag the smaller mesh through the bigger one and collision can be detected fine. I am using void OnCollisionEnter ( ) instead of void OnTriggerEnter(). Is there any way to make a mesh impenetrable?

Thanks!!

Depending on how you are moving your object (if you aren’t applying a force) it would still be easy to move a smallish collider past another one in a single frame. Plus directly manipulating transform.position will pretty much trump (or at least produce unusual non-realistic movement) the physics engine.

Try applying a force to get your object to move where you want it OR use a spring joint and an intermediate gameobject (that the player directly controls with .position).