Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 37930
In Process

askthedev.com Latest Questions

Asked: February 16, 20252025-02-16T02:14:02+05:30 2025-02-16T02:14:02+05:30

How can I improve collision response for a box experiencing gravity with low relative velocities to prevent unrealistic behavior?

anonymous user

I’ve been working on a physics simulation for a 2D game where I have a box subject to gravity, and I’m running into some issues regarding collision response, particularly when the relative velocities are low. The scenario I have is pretty straightforward: I’ve got a box rotated at 30 degrees, sitting on the ground, with gravity pulling it down. When a collision occurs, my impulse-based collision resolution model is supposed to handle it, but it’s behaving kind of oddly.

So here’s what happens: because the box is essentially at rest with very low relative velocity at the point of collision, the impulse generated is super tiny. This causes the box to precariously balance on its edge for what feels like forever, and it doesn’t settle back onto its side until it finally accumulates enough angular velocity. It definitely feels off, like something fundamental is missing from how I’m dealing with the physics.

I’m starting to think that I need to incorporate something that takes external forces like gravity more into account during collisions when we’re dealing with these small relative velocities. I’ve shared my collision impulse calculation code because I suspect there might be a bug or maybe just a missing component in the logic.

For instance, I’m wondering if my calculation of `angular_effect` is enough, or if I should add a function that injects additional impulse based on the gravitational force acting on the box or something similar. It’d be great to get some fresh eyes on this to see if anyone has suggestions for how I can improve the collision response here.

Have you guys tackled similar issues, or do you have any recommendations for modifying the impulse calculation to better align with real-world physics? I’d love to hear how you might approach fixing this so it feels more natural in the simulation. Thanks for any insights!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-02-16T02:14:03+05:30Added an answer on February 16, 2025 at 2:14 am

      Physics Simulation Help

      It sounds like you’re really diving into some interesting physics stuff!

      From what you described, it seems like your box is having a tough time settling down after the collision. When the relative velocity is low, I guess the impulse really is tiny, and that’s why it’s balancing like that.

      Maybe one thing to think about is adding some damping to your collision response? Like, you could apply a little extra force to help it settle down when it’s at such a low velocity. It might feel more realistic if you add a tiny force based on gravity to nudge it back onto its side.

      For your angular_effect, you could also try to see if there’s a threshold for velocity below which you apply a different response. If it’s super low, maybe just give it a little push to get that angular velocity going so it doesn’t sit there forever.

      And if you’re thinking about incorporating gravity during collision, maybe calculate the force acting on the box and add that into your impulse calculation as well? Just a thought!

      It’s great that you’re seeking help on this! I’m sure with a few tweaks, you’ll get your physics feeling more natural. Good luck!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-02-16T02:14:04+05:30Added an answer on February 16, 2025 at 2:14 am

      It sounds like you’re dealing with a classic issue in physics simulations, especially regarding low-velocity collisions. One potential solution is to introduce a minimum threshold for the generated impulse. When the relative velocity is below this threshold, you can apply a predefined impulse that takes into account the gravitational force acting on the box. This way, even if the impulse calculation results in a very small value, your simulation can ensure that the box remains stable and doesn’t balance precariously on its edge. Additionally, consider incorporating a damping factor that helps encourage it to settle into a stable position more quickly, especially after collisions.

      Another aspect to consider is the addition of a friction model that can dynamically increase the friction coefficient based on the angle of the box. When the box is at a steep angle, and the relative speed is low, the friction could be made stronger to prevent sliding while allowing for some rotation to let it settle naturally. Furthermore, enhancing the calculation of `angular_effect` with a function that integrates the gravitational force, and possibly even the box’s mass, could lead to a more realistic interaction during collisions. This approach aligns better with real-world physics and should help create a more natural feel in your simulation.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.