- Home /
Pick and move physics object
I am trying to create a system for picking up and moving an object with physics.
My requirements are:
the object flawlessly follows the movement of the player, without jitter or delay;
it must have collisions with all objects.
From the many tests I have made, the only way for the picked object to properly work with collisions is for me to move it with AddForce. The problem is this severely difficults the other requirement, making the object either move slower than the player or jitter.
As suggested, I have tried both hinge joint as well as configurable joint and the result I got when moving against a wall was this:
With my script using AddForce its much better, I get this:
My problem is mostly when moving the object, its not that big but look:
I would like to improve this even further. Any suggestions are appreciated, thanks in advance.
Answer by NorthStar79 · Nov 21, 2017 at 09:08 AM
check this : it should work as you intended with almost no efort
if this answer helped, please consider to mark as accepted answer, this way anyone who looking for the same question can find
Thank you for your suggestion. $$anonymous$$aybe I am missing something but I have tried both adding the fixed joint to the player or the picked object and both seemed to allow for traversing of walls if enough movement was made in that direction. It also caused a undesired property of pushing the player away when hitting a wall. From my very simple testing, my previous system with AddForce still works a little better. Once again, thanks.
if fixed joint didn't provide enough functionality, then using configurable joint is the way to go. it needs a lite bit more (a mean much more) attention and time to set it up properly, but you can make almost everything that you can imagine. I am not really recommending moving picked object with AddForce, since things could get messed up quickly.
I've added gifs to show what is currently happening with joints and with forces.