How do I stop jitter in Physics?

0 favourites
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • EDIT: The final realization of this thread (discovered by blackhornet) was that when Gravity is set to higher than 50, "Properties > Framerate Mode" behaves jittery when in V-Sync mode and works flawlessly when set to any other mode. It could be a bug according to dop2000, but I would like to hear from Ashley first before reporting it because I don't have the technical knowledge on the matter.

    Hi there.

    I've tried a bunch of different settings and tutorials, but I just can't seem to stop these dice from trembling all over the place.

    Just left click to create a bunch of squares and see the behavior in action.

    I believe this is mainly something wrong with my input values, so if you could help with that it would be awesome.

    github.com/dupuqub/constructs/blob/master/Dice.c3p

    The GIF below is using the out-of-the-box settings that come with adding the physics behavior in both the green dice and the black immovable block. Should I file a bug Ashley, since it immediately fails without me touching anything?

    EDIT: After some testing with the out-of-the-box settings, I saw the jittering only occuring with a gravity higher than 50. Later I tested with many tweaked settings and gravity seems to always be the culprit. I couldn't find anything on the matter in the docs, so should there be some relevant note in the docs or is it a bug or am I missing something? It is very much a trap for anyone tinkering with physics, since there's no obvious reason to not go further than 50 in gravity, and there's also no clear indication that gravity is screwing things up.

    Deeply appreciate any feedback, Cheers.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Are those resting on a immovable physics object? Or the bottom and sides of the screen?

    I believe using the confine to layout behavior on physics objects restrains them in a non-physics way, if that makes sense.

    If not, did you try increasing any of the following:

    • friction
    • linear damping
    • angular damping

    I don't believe it is a bug. Though not desired it just looks like physics objects looking to find resting spots. There is probably something not allowing them to do so.

  • They're confined to immovable physics objects, confining them to the layout and/or to the screen is not always viable, therefore it should not be considered a solution.

    Also I tweaked every setting, including friction and dampings from both parties (the squares and the immovable block). As stated previously, the problem lies in the Gravity setting.

    And yes, you're right, every time a physics object is moving, it is finding a resting place, can't see how it could be any different.

    And also yes, it is undesirable, therefore, as I mentioned, there should be some sort of note on the docs or maybe, if possible, something should be done about it in the engine.

    EDIT: As a last reminder, everything happened with out-of-the-box settings, except for gravity, that's why I'm confident in my findings and hoping something can be done about it.

  • Physics world is delicate, sometimes you change one value and everything stops working.

    Check out the "Physics: Rolling Platformer" template. I tried setting gravity to 100 and the boxes there still don't jitter. You can copy their properties to your project.

    Also, try different values for "Set stepping iteration" action.

  • Hi.

    I searched you Construct demos site, but couldn't find a demo with this title. Which one is it exactly?

    I'm currently trying out the step iterations and modes.

    EDIT: On 100 Gravity, I just went as far as 64 iterations for Velocity and 24 for position and there is still jitter with default settings. There was also no difference between modes (fixed or framerate independent).

  • Odd. I tried "Physics: Rolling Platformer" with gravity=100 and it's vibrating like crazy.

    Edit: it's tied to framerate. Changed from V-synced, and now it's steady.

  • Odd. I tried "Physics: Rolling Platformer" with gravity=100 and it's vibrating like crazy.

    Edit: it's tied to framerate. Changed from V-synced, and now it's steady.

    YES! That's a breakthrough right there.

    Could anyone care to comment on the implications of not using V-Sync though? I've always assumed it is something desirable in gaming, although I have no technical knowledge on why that would be true.

  • I searched you Construct demos site, but couldn't find a demo with this title.

    It's the official C3 template :)

    Afaik V-Sync mode is for publishing, other modes are for testing only. My laptop has 60Hz screen, maybe that's why it works fine for me.

    If physics behaves differently with different V-sync setting, this does seem like a bug.

  • This is all managed by Box2D - I can't explain why it happens, it's a third-party library that manages the physics simulation and produces that result.

    I would strongly advise you not to change the framerate mode to unlimited - it will burn up the full system resources, draining battery as fast as possible, overheating laptops, spinning up fans, etc. It exists for performance testing only.

  • Ashley, therefore physics is unusable with Gravity > 50. At least in some cases, certainly mine and blackhornet . Don't you think there should be a note somewhere in the docs about it? It is a major deal and we currently know what causes it, gravity.

    Also it's very disheartening seeing that something like this can't get fixed, I don't believe this would be the case in any major game development platform, and as always, Construct is my favourite one, but sometimes it really punches me in the guts.

  • At least consider something, because the gif below shows completely out-of-the-box settings with Gravity = 10 and the objects never sleep in V-Synced mode.

    At this point is useless having "is sleeping" function as well, just pointing this out as it seems more trouble brews within the Physics engine.

  • I don't know what to add, this all looks like internal details about the Box2D physics engine, which is used widely across the game industry. I think it's pretty standard practice to have to adjust the settings of a physics engine to ensure it produces a stable result.

  • Couldn't bake in your own sleep system that compares object velocity and then sleeps the physics behaviour, sets the angle to flat, and then enables again when you deem it necessary (on input, on distance with moving object etc)?

  • Couldn't bake in your own sleep system that compares object velocity and then sleeps the physics behaviour, sets the angle to flat, and then enables again when you deem it necessary (on input, on distance with moving object etc)?

    Yes I could, but this is not what Construct is about (at least what it is said to be about). If I just go make my own Physics tools then Construct loses its value for me.

    Ashley, I will try to investigate Box2d issues to try to assess wheter or not there is something wrong here, can you disclose which Box2d Javascript port Construct currently uses? I found many, but it seems better to just test the one C3 uses since it won't be tested by you.

    Thanks is advance.

  • If you google: box2d gravity jitter

    you'll find others with the same issue, in other physics engines also! This is just a side effect of simulating something. It can never truly be accurate.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)