Since Unity 5.1 I found out that there is a bug or unexpected behaviour of physics or implementation of AddForce / AddTorque on collisions of two colliders. I have the following scenario: when user touches the screen the player accelerates (addForce) until the player reaches a given MaxSpeedBound, that is checked in the FixedUpdate, where the addForce is applied. When the player touches another collider(not trigger) he is slowed down, just the way it should be, with correctly computed physics properties from Unity 4.3 to 5.0. But with 5.1 what happens on collision now is:
The colliding object just flies off as fired from a shotgun and the speed of the player becomes many times of MaxSpeedBound, flying also like crazy. It seems that AddForce adds potential energy, which cannot be detected when comparing if the current speed < MaxSpeedBound, since its “potential” speed, and potential force cannot be read out so far. So ignoring the speed check the addForce adds within some milliseconds on collision with other colliders many times potential energy and the so blown up potential energy becomes kinetic energy and both object fly away at the “speed of light.”
As I wrote, in Unity 4.3 to Unity 5.0 nothing like this was happening, now I am desperate :-/ Is this a bug or a feature of Unity 5.1?
UPDATE: just downloaded and installed the old 5.0.3 version 32bit. I had a backup from last week before rebuilding to 5.1. Opened it with 5.0.3 - all perfect.
Then opened same project with unity 5.1 version 64 bit and rebuilding of project: collision detection and AddForce / AddTorque broken as described already.
Opened the same project with 5.0.3 and after rebuilding the bugs in the project remained and got even worse.
What is Unity 5.1 doing when making a rebuild? Physics of my game get broken after.
I’m confused; the title of this thread says ‘2d AddForce / AddTorque / Collision misbehaviour’ yet you link to 3D problems. Also, one of those threads isn’t a problem with Unity3D but with what the user is doing.
You’re saying that things are rotating in the opposite direction and you’re having to inverse the torque? That would be disastrous and I’m sure most users would’ve spotted it. Is this 2D/3D?
I’m not doubting you’re having problems and I’d like to help but I’m just not clear on what your problem is.
It’s a 2D game. User presses a button and AddTorque is applied on player’s rigidbody2d in the fixedUpdate until given max AngilarVelocity is reached. After rebuilding the project with Unity 5.1 the torque is applied in the negative direction, thats why I had to multiply the direction with -1. Then on any collision with other object the player starts to rotate at speed far beyond max value, the other object flies off the screen with high velocity.
I have no idea what is going on there. I do know I’d be flooded with reports if this were the case as a general problem.
Maybe you can submit a bug-case and report the number here so I can take a look at it for you. Alternately, provide a link to a simple reproduction case.