21.9 C
New York
Sunday, August 10, 2025

physics – How one can settle a inflexible physique to relaxation on flat floor


I’m making an attempt to simulate the behaviour of a inflexible physique, for instance a dice, whereas it settles on a flat floor. As an instance 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 transferring.

For the time being, the impact I acquired 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 making an attempt 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 develop into frantic; the dice is dancing wildly and never settling.

To clarify a bit extra, each body I’m gathering 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 technique 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 many others.

Any recommendation on how one can method this specific downside?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles