I’m currently trying to see how objects react when they’re being centrifuged. I have a 500 cm radius wheel spinning at an angular velocity such that centripetal acceleration at its radius is about 1g.
The attached screenshot illustrates the setup: the checkered solid is the ground, the camera is looking down from above. The colored lines are debug only, and the black lines represent the normals of all contacts for the boxes.
In this scenario, there are 2 boxes and 2 mannequins, one of each is affected by gravity, and thus lying on the ground, while the other is not, and gets centrifuged by the wheel. So far so good.
The issue appears when an object gets close to a resting position in the rotating frame of reference (the camera is attached to the wheel and turns with it, so the object appears to be almost static, as if resting on the ground): the object starts slowly sinking into the wheel, and either continues to do so until it passes through, or is ejected at high speed back inside.
The following video shows the issue: https://dl.dropbox.com/s/6bjm468h83vvvgf/GravAr_collision_01.mp4?dl=0
In this scenario, gravity is not applied to objects. There are also transparent solids to prevent the objects from falling off the sides of the wheel.
As you can see, the general behavior of the objects is correct, but they start sinking into the wheel (the mannequins generally jerk a little, while the cubes can sink all the way through at times).
Also notice how the contact normals (black lines) change and rotate for a few frames, then suddenly come back.
I have tried tweaking several options to fix this:
- physics sub-stepping, with high and low max delta time and substep numbers
- CCD, PCM, async scene (not sure what that last one is exactly, though)
- solver iterations for position and velocity (defaults are 8 and 1 respectively, I went as high as 32 and 16 with no noticeable effect)
- probably a few other things I can’t remember
From all this, there is an obvious result: either I’m completely missing something, or there is an issue with the way physics are computed.
The problem is not the wheel or the objects themselves, as a non-rotating wheel will allow objects to rest on it with only gravity acting on them, and they will then go to sleep; even if I manually disable sleeping, their jerking is minimal.
When the wheel is spinning and gravity is disabled, however, they will invariably sink - the issue quite clearly comes from the velocity of the objects (about 640 cm/s in this situation).
I guess a workaround would be to implement a “dynamic sleeping” system, where the objects would be attached to the wheel (or other objects, when stacking) if the relative position and velocity are small enough, but I’m pretty sure having a ball inside a spinning wheel should be stable at only 1g (the sinking behavior is also there at lower angular velocities, and is amplified at higher velocities).
If anyone has an idea, or if this can be confirmed to be an issue with Physx, I would appreciate help! Thanks and sorry for the long text.