Dragging Rigidbodies With Collisions

Hi all,

I’ve got a system in place to drag some rigidbodies around. They have colliders on them set as triggers, it works great! However rather than triggers I now want these to be active and actually collide and stop. I have tried using the DontGoThroughThings script (a couple of versions) and its not working for me (even with the skin width set to 1).

Here is some more information that might help:

  • This is on iOS
  • The Rigidbodies should not be movable unless they are being dragged
  • Dragging should only occur locally along the X/Y plane, its local Z position should always stay the same.

Any help is appreciated!

Adam

I help someone with a similar issue recently, and used a boxcast to determine if the next drag was allowed.

Their example was moving furniture around on a floor, but didn’t want to allow it to pass through other pieces of furniture. Even if you want to move only x/y, I believe the solution could be similar.

This is the only thing I could think of on the topic, because dragging won’t obey physics exactly.

Hope that can help you a little bit.

Thanks for the reply. Would love to chat with you more on this at some point?

Adam

Sure, I mean you can think about it and try it out. Feel free to write back on how it goes…

In my trials with helping the other person, my code would prevent an object from even touching sometimes (just short ) – I didn’t include extra code to make it go “as much as it could before hitting”; the code only made sure it didn’t go through. However, I think the extra code could have been added.

1 Like