- Home /
What can cause extreme velocity of 2D Rigidbodies?
I have thousands of RB2Ds with circle colliders all held in place with SpringJoint2Ds (anchored to positions, not other bodies). Sometimes, for no apparent reason, small groups of them (1-8 ish) go from velocity <30 to Mach 7 in one tick.
Nothing in my code sets the velocities to anything other than 0, or a previously cached velocity (e.g if the player moves away, unloading the body, and comes back, reloading it). Likewise, the positions are never set through code, except when the bodies are created.
I do have the bodies frequently sleep/wake up and simulate/unsimulate in square "chunks" to maintain performance. E.g if a chunk of bodies has gone to sleep, then their RB2D component can be unsimulated until something enters the area of the chunk.
Thus my theory was that the issue was caused by unsimulated bodies overlapping simulated ones, then being re-simulated, and causing collision repulsion. However, this would imply that both bodies receive a large (equal and opposite) force, which is not the case. All instances of this glitch have the affected bodies moving in the positive X and Y directions.
Any ideas about what could be causing this would be appreciated!
Your answer
Follow this Question
Related Questions
2D Geometry dash-like ship physics 0 Answers
How to Smooth Out Constant Velocity on Rigidbody2D 1 Answer
Diagonal jump results with weird motion. 1 Answer
NullReferenceException: UnityEngine.Rigidbody2D.get_velocity() 0 Answers
Do rigidbodies (especially 2d) have limits on their velocities? 1 Answer