I’ve created a ragdoll-like character using hinge joints.
When the character hits the ground the flies idk where, unity gives a warning :
Shoulders:
Legs:
Hands:
i
Any idea what I might be doing wrong?
Thanks.
I’ve created a ragdoll-like character using hinge joints.
You mean to say the ragdoll “explodes” respectively is hurled into space?
Then that’s the original problem. Your “ragdoll” isn’t actually a ragdoll but supposedly a manual setup of colliders and joints.
You most likely have those colliders touching or intersecting and the joints try to keep them intersecting, but physics simulation won’t let them. This may be compounded by the hinge joint (inappropriate for a ragdoll) and/or enabling collision between the connected objects, and most importantly by using box colliders as they don’t have rounded corners, thus as the box collider turns it will almost certainly start to intersect with the other box collider.
The two opposing forces at play quickly try to pull in opposite directions, like two parties pulling the same rope. Except the force with which the objects are pulled is growing to infinite really quickly. This hurls the object into space. The warning you get is just a reminder that transform positions should remain well below 10,000 units in any direction.
Space your colliders apart, at least the minimal contact distance specified in the Project Settings under Physics.
But ultimately for a ragdoll you want to use the Ragdoll system which lets you easily setup a ragdoll for any humanoid character (eg pick one from Mixamo).
I haven’t encountered this specific warning in Unity, but open-world games often face limitations related to floating-point precision. Based on your screenshots, it seems likely that Unity is warning about this issue.
Floating-point numbers (e.g., FP32) don’t cover their entire range uniformly. Instead, only a finite number of values (around 2^32 for FP32) are available, and numbers are “rounded” to the nearest representable value.
The distribution of the available numbers is not a continuous uniform distribution, the floating numbers that exist are densest near zero and become increasingly sparse as you move away from it. In fact half of those available numbers exist in the space of [-1,1].
As a character moves further from the origin (zero), precision errors grow due to this rounding effect. At great distances, these errors can cause movement to appear “choppy” or discontinuous, as the character seems to “teleport” between points.
To mitigate these issues in large open worlds, developers use techniques to keep objects near the origin, one way is that instead of moving the character in the world, we are moving the world underneath the character. For example instead of moving the character one unit forward we move all the world (with everything available in it) one unit backwards. This way the character is always at the center position and his movement never seems “choppy”.
Obviously there are other ways to achieve that, like moving the world only at certain thresholds or having a world that is not continuous, but at certain limits a new scene is loaded and our character is placed at the center of the coordinate system again.
Unity seems to be alerting you that your character is moving too far from the origin, leading to significant precision errors that will cause choppy movement. Deciding whether to address this depends on your game. If the character is no longer visible at large distances, it may not matter. Otherwise, consider implementing one of the solutions mentioned to maintain smooth movement and reduce precision errors.
The answer is in the title of your post!! From your screenshots, your position coordinates are at least 3000 in the x and something like 36000+ in the y.
Bring those closer to zero. Stay within (1000,1000,1000) generally speaking.
If you do not then floating point error introduces large jumps between possible positions, and thus will effectively inject spurious “energy” into physics systems, straining joints and making the physics a mess, which is likely why your ragdoll explodes.
Thank you so much for the help, everyone!
It turns out I didn’t enable “Enable Collision” on the hinge joints, which was causing the colliders to malfunction and fly off.
I really appreciate all the help.
Thank you!