I’m quite new at Unity, and I did my best to search the forums for a discussion of this issue without much luck.
For my game, there may be many rigid bodies (crates and elongated cubes) stacked on top of one another that are immediately shown to the user. I have painstakingly placed the objects so that they line up perfectly. However, when I load the scene, the objects move ever so slightly and cause the entire stack to sway and jitter. The higher my objects are stacked the longer it takes for the swaying to stop. I know this is from precision issues, but there must be some way to avoid this.
(FYI: The objects are just standard cubes created from Unity’s GameObject menu. I change their shapes by changing each cube’s scale.)
Also, I will procedurally drop new crates on top of another crate, and the same issue happens.
Awesome, this may do the trick. I do have one question though… I have a large stack of rigid bodies, and I put them all asleep at startup. Now, let’s say I bump a rigid body at the top of the stack. Will this create a chain reaction where everything wakes up, and now everything will jitter just like before? In other words, doesn’t this just delay the jitter and settling until the first collision?
I solve this by having a system for displaying a loading screenish thing, while letting the bodies settle.
Basically there are 3 scripts involved:
InitLevelGui.cs ← organizes everything and displays the loading screen
InitWaiter.cs ← Objects with this script attached are immediately deactivated in the Awake() function, and are later awoken by the InitLevelGui
IProgresser.cs ← an interface implemented by all objects in the scene that might want to cause the loading screen to display
So when all IProgressers in the scene are reporting that they are done, the InitLevelGui wakes up all the Waiters, and stop drawing the full-screen loading GUI.
I’m having a similar problem. It seems there would be a more elegant way to solve the problem than what magwo suggested (no offense).
I have found that allowing objects to settle, then copying their positions (including all the decimal places) and then setting that as their starting position seems to work well.