Hey y’all,
I’ve been searching the forums for the past few hours and I’m stumped. I need to be able to drag a rigidbody around without it going through walls, like the carrying function in Portal. For various reasons I’d rather not elaborate on I can’t use the Springjoint method. I don’t need a full script or even a snippet, but a few nudges in the right direction would be nice. Thanks to everyone in advance.
You can add a force to the rigidbody object based on the direction between its position and the point clicked with the mouse. Generally, you will have some restriction on where the object can be dragged (within a plane parallel to the camera, say). You might be able to implement this using a temporary configurable joint on the rigidbody object. The clicked point in the scene can be found using a raycast (see this thread for an example) or with Camera.ScreenToWorldPoint.