Can You Prevent a Dragged Object From Going Trough Another?

I have an object that can be dragged around the scene. While dragging, I set isKinematic to true and update its position based on mouse coordinates. When it’s released, I set isKinematic back to false so it’s controlled by physics again. The problem is, the object can be dragged through other objects in the scene. Is there any way to make the object respond to colliders, and not move through them, while it’s being dragged?

Can’t you just disable isKinematic and turn gravity off?

does the object have a collider on it?

I have isKinematic = true; and use gameObject.rigidbody.MovePosition to update its positions. This way it will collide with other objects that has Colliders and prevents it from going thru them