Hi everyone, I’m new to Unity. I’m in the process of learning it. For background info, so far I’ve looked through all the intro documentation, read the entire User Manual, done most of the 3D Platformer Tutorial, and read the initial scripting reference pages.
Anyway, on to the matter at hand. I’ve found several bugs in the physics engine. Looks like some related issues have been mentioned a few times in the forum but never truly addressed by the Unity team. Here’s the errors:
Bug 1
If you drop a simple rigidbody cube or sphere object with material set to “Bouncy” from rest above a flat collider surface the object will begin bouncing higher and higher with every bounce even though no force or energy is being added to the system.
This is a violation of the Law of Conservation of Momentum, which is quite possibly the most fundamental law of physics, seeing as Newton’s laws are essentially based on the principle. For such a simple case, the fact that this error occurs is very alarming. Even when dropped at small heights of 2 “meters” or so the objects will quickly start gaining height at a rate of about a tenth of a meter per cycle, which is a HUGE error in the context. Yes, engines have numeric errors, but for such a simple system of objects the error is unbelievably high.
Bug 2
Cubes which bounce like in the above scenario also slowly move along the x-axis, even though the collision normal force should be exclusively upwards.
Bug 3
Unity’s simulation of drag for rigidbodies completely ignores the effect of the object’s mass against the drag. In physics, objects with greater mass should have a higher terminal velocity (which is caused by drag) than those with less mass.
For example, when the bouncing objects in the above scenarios have drag values set they will (bizarrely) gradually gain or lose height until they are at equilibrium with a bouncing height related to the terminal velocity of the drag they experience. However, the problem is if you then change the mass of the bouncing object (such as changing it from 1 kg to 999999 kg) then the bouncing height will not re-balance to a new height, which means the terminal velocity isn’t changing either even though the mass has been changed. In other words, Unity’s implementation of drag doesn’t follow even the most basic rules of real world drag, so it seems.
These bugs are all very obvious, and it feels almost as though the Unity physics system was therefore barely tested at all. These are practically the very first things that the people testing the engine should have been looking for, as they are extremely simple and obvious cases to test, which have potentially catastrophic consequences for the game state.
On a different subject:
Unity does not sufficiently document the units of many of it’s components. For example, is the static friction value the coefficient of friction or is it the max force with which the surface can resist friction motion? It appears to be the former (the coefficient of friction) but nonetheless it would be wise to document such things. Many of the most important technical aspects of the unity engine are often left almost completely undocumented, often having only a brief description of the obvious and not the relevant technical facts one needs to properly use it without resorting to excessive testing and guess work to derive the underlying interpretation based on context and effect.
I’ve got some other issues to address as well, but I’ll leave it at that for now for the sake of thread relevance.