- Home /
Why Fixed Join behaves like spring?
Hi everybody, I'm new in Unity! When I connect two rigidbodies together with FixedJoint, it's not solid - it behaves like a spring. (The first object is "chasing" with delay the second one) If I change "Solver Iteration Count" parameter from default 6 to for example 90 - the connection is solid, but I've read that this can drain the performance... How I can fix that?
Thanks in advance and sorry for my english ;)
Answer by Jason B · Jan 23, 2011 at 09:54 PM
Solver iterations can reduce performance, true, but you should check your FPS to see how much effect it's actually having on performance before you decide to look for another alternative. In my experience, you have to increase your solver iterations quite a lot, and then have quite a lot of physics objects before this starts becoming an issue.
The only other alternative for improving physics accuracy (that I know of) is changing the physics time step (this is how often physics are calculated per second) but that I know for a fact has serious performance side effects (if you adjust it to be higher quality). Time step differs from solver iterations because time step means how many times per second physics is calculated, whereas solver iterations is how thoroughly and accurately each calculation is performed.
Therefore, solver iterations is indeed what you should be using.
Unfortunately, you can't "fix" any drain in performance that may be caused by increasing the solver iterations. Or in other words, you can't get more accurate calculations without paying a higher processing price. :) Now, you CAN increase solver iterations for more accurate calculations, and then enhance performance a bit by raising the physics time step, but I don't recommend this because the more you raise it, the lower your physics simulations run in frames per second. If you have a game running at 60 FPS, and physics objects simulating at 30 times per second, for instance, it looks really icky.
Answer by Ostin · Aug 27, 2011 at 01:26 PM
You can fix it very easyly and efficiently. Here is my solution.
The object your joint is attached must be parent of the object you are trying to attach.
On start store it's local position.
Every frame in Update() function reset its position to initial local position.
Don't do it in the FixedUpdate() because object will still move in every frame. The compound objects will be diamond hard but will although break as they normaly do.
This way You can fix other joints too, but it will be not that simple.
Can you post your script? Becouse $$anonymous$$e is working only on static objects like a tree.
Your answer
Follow this Question
Related Questions
How to make two objects connected by a joint collide? 1 Answer
rotate object that has FixedJoint2D 1 Answer
Editing joint programmatically? 2 Answers
Hinge joints not reaching target position 1 Answer
Rotating object between two points? 1 Answer