Saturday, August 9, 2025

physics – Tips on how to settle a inflexible physique to relaxation on flat floor

I’m attempting to simulate the behaviour of a inflexible physique, for instance a dice, whereas it settles on a flat floor. As an example it lends on an edge and even on a nook, and now it has to settle and stay on the floor. I’m modeling this by rotating the physique round contact line or a contact level, however I’ve an issue when the physique must cease shifting.

In the intervening time, the impact I bought is that when it lands on the floor, it’s nonetheless not completely aligned with it, so in my collision detection I’m detecting that I nonetheless have only one contact level, so I’m attempting to generate rotations round this contact level.

After this, one other edge or nook turns into the contact level, so it begins to rotate round that one and shortly issues grow to be frantic; the dice is dancing wildly and never settling.

To clarify a bit extra, each body I’m amassing knowledge about which of the corners is closest to the floor of curiosity and storing this knowledge in a C++ kind, std::vector. If I’ve a consequence that each one 4 factors(corners) are on the identical distance, I put all of them inside a vector. After the collision detection methodology is named inside my physics engine code, I attempt to resolve it, and I do that by returning the information about collision factors and corners and so on.

Any recommendation on find out how to strategy this explicit drawback?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles