- Home /
Problems with DragRigidBody.js
I'm using the DragRigidBody.js script from Standard Assets. For the most part the script works fine, however when trying to drag it through a wall it starts jittering around (rather than sticking to the wall).
It looks like one frame the object will go partially inside the wall then the next frame it goes outside of the wall where it should be in the first pace.
At times depending on the speed of the drag parts of the dragged object (ragdoll) will go through the wall completely and get stuck on the other side of it.
I tried messing with the collision detection type (both continuous options) but that didn't fix it.
Am I missing something? I was wondering if it's ok that the script does all this physics work in Update, should it be FixedUpdate?
Try:
Edit/Project Settings/Physics
Set $$anonymous$$in Penetration For Penalty to 0.0.
I agree the spring setting seems to be making the most difference, but has a cost in perceived responsiveness. Can you make your comment into an answer so I can accept it?
For my tests, the Solver Iternation Count made a big difference. I believe this setting is only used for joints, so if you don't have joints elsewhere, it might be something to consider. I converted by comment into an answer.
Answer by robertbu · Jul 23, 2013 at 06:45 AM
I played a bit. I did not find a solution, but I found three things that improved the behavior:
Go to Edit/Project Settings/Time. Reduce the Fixed Timestep to 0.01 or below.
Select the object the DragRigidbody script is attached to and reduce the Spring setting some...35 to 45.
Goto Edit/Project Settings/Physics and reduce the Solver Iteration Count. Try a value of 3. Note this may have an adverse impact on your physics elsewhere.
For future reference, this does improve things but does not fix it completely - it basically increases the maximum distance the drag handle can be behind the wall before the jitter starts (easiest tested in non-maximize screen mode in unity and drag mouse all the way to the side of the screen).
Your answer
Follow this Question
Related Questions
Stop Object From Ignoring Collisions - Pick Up Rigidbody 0 Answers
Problems with clicking an object with my script 0 Answers
DragRigidbody Not Working Properly 2 Answers
how to instantiate an object every second? 2 Answers
What's FixedUpdate 2 Answers