What I’m trying to achieve
I have a platform that can be tilted on two axes and a sphere that should “roll” based on the platform’s degree of tilt. I’m leveraging the out of the box physics to get the sphere to roll. The sphere should roll “naturally” and collide with the platform’s walls.
Problem:
Sometimes, not every time, when the sphere rolls into a corner and the platform is then tilted downward away from the sphere the sphere will become suspended in air as if it is “stuck” or no longer respecting gravity. I’ve not implemented anything special for gravity that comes out of the box. Once the sphere is suspended it either drops back to the platform surface after a few seconds or requires the platform to be tilted in such a way that it collides with the sphere again, which causes the sphere to once again roll as expected across the platform surface. This can also happen when the sphere rests against a wall.
I’ll include video clips to illustrate the problem behavior and the expected behavior where the problem doesnt occur.
Sphere gets stuck in the corner then drops after a few seconds. Then the sphere rolls and collides as expected
[sphere stuck in corner, then rolls OK.
Sphere pops up a small amount when the platform begins tilting rather than riding platform normally. 15 seconds into video. sphere pops up.wmv (1.8 MB)
Sphere gets stuck on a wall
Here are a few additional details about my setup for the platform in case there is something there affecting the physics.
The platform is made up of multiple block parts that are welded together to create a continuous surface. The walls are welded to each other with one wall part welded to one surface part. This is to ensure that all parts move together as the platform is tilted. One part in the surface of the platform is attached to an align orientation and that align orientation is attached to a separate transparent part that is anchored at another location. The transparent part is what is manipulated with a tilt degree via script. The align orientation then tilts the platform to match the tilt with a “smooth” movement. One part of the platform is also attached to an align position and that align position is attached to another transparent part that is anchored at the center of the platform (transparent with no collision enabled). The align position constraint is intended to keep the platform suspended without the need to be anchored so that its orientation can move via the align orientation. The align orientation and align position are both parented to the same part of the platform.
What I have tried to address this problem
Adjusting the settings of the align orientation and position config.
Tested with a block part and have not been able to replicate the issue. It slides into and out of corners without getting “stuck”
Setting massless to true for all parts of the platform
I’ve looked into the decomposition geometry, but as the platform is made of standard block parts and the sphere is a standard sphere part I dont see any areas where the geometry looks off/abnormal.
Tried using smaller parts to make up the platform and walls rather than few larger parts.
Thank you for the tip @qwertyexpert. After some additional research I stumbled across a post about sleeping part bugs (Waking Sleeping Parts - #8 by ItsSkeIIy). I disabled the allow sleep physics setting and am not able to replicate the issue now. I’m hoping this will finally resolve this issue.
Also, thanks for the advice on converting clips to .mp4.
I am not setting the network ownership of any of the platform parts or the sphere, nor have I experimented with this. If the disabling of sleeping fails to resolve the issue I will try this. However, there will only ever be one player within a “close” proximity of the sphere or platform parts and that player will remain at a consistent distance. All movement of the platform is handled from the server
That’s a Studio-only setting. The only way to fix it for real is to contact one of the physics developers to get this resolved globally (you should do this), or use a fancy trick to keep the part from sleeping indefinitely.
Oh no, I didnt think about that… so disabling the setting will not prevent the issue once published and played outside of the studio. Any advice/tips to prevent parts from sleeping or to constantly wake parts? The sphere should always be awake as it will always be the focus of the game play while it exists in the game. The only thing I can think of is applying angular velocity, but I dont think that can work without having negative consequences to the gameplay. The player should be able to direct the sphere to a place where it will temporarily come to rest for an unpredictable amount of time before tilting the platform and bringing the sphere back into motion at an unpredictable direction. Forcing the sphere to move would likely give the player an impression that the sphere is moving on its own (glitchy).
I was considering creating a post in the bugs section, but I am not expecting a solution from the Roblox staff to fix the problem as who knows how long that would take (if ever).
I believe the best way to keep the part awake is to apply an extremely weak downwards BodyForce. This shouldn’t affect your gameplay but it should fix all your sleeping part issues.
I’ve experimented with a downward body force and can still replicate the issue, which is a bit shocking. I’ve read several other posts suggesting using a downward body force to keep stationary parts awake. I’m creating the body force instance when the sphere is created and it remains a child of the sphere while the sphere exists. Here is a snippet of code for the body force.
Didnt even know that existed. I’ve turned that setting on and tested again. The sphere is in fact, along with the platform, falling asleep when the platform is no longer moving and the sphere comes to rest… sometimes.
After experimenting more on how to continuously check whether the sphere has fallen asleep and how to wake the sleeping sphere I believe I have come to a work around. I’ve written a loop, with a small delay between iterations, that will check whether the sphere’s AssemblyAngularVelocity is at (0,0,0) to see if its come to rest and likely may be asleep. When this is true I wake the sphere by updating its AssemblyAngularVelocity on one axis to .01, which is a rather insignificant amount and not enough to move the sphere enough to be visually noticeable. This has been successful in at least waking the sleeping sphere often enough to really reduce the impact of the sphere falling apart.
I can only guess that the body force failed to wake the sphere because it was pushing the sphere into the platform, which didnt result in any actual movement and therefore wasn’t enough to stimulate physics to wake the sphere.
Unfortunately, I dont have access to post a bug on the forums for this.