- Home /
Question by
lakiid373 · Oct 29, 2020 at 11:20 AM ·
2d gamegravity2d-physicsfallingconstraints
Freeze constrains bug or idk
if (Input.GetMouseButton(0)) {
m_Rigidbody.constraints = RigidbodyConstraints2D.FreezeAll;
}
else
{
m_Rigidbody.constraints = RigidbodyConstraints2D.None;
}
Hi, so i have a 2d game where a ball falls and when i press a button it should stop in the air and when i release it should continue to fall. The code above did this flawlessly until the newer versions of Unity (more precisely it works in 2019.2.6f1) but in the newer versions if you stop the ball(freeze constrains) when you release the button the ball is still frozen. And the most interesting part is that sometimes it works as intended but most of the time it doesn't. Plz help, if you have another solution to stop the ball in the air while you hold the button and when u release it falls fell free to share it.
Comment