🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Why does ConstraintSolver not solve properly? (Please bless me with some help I'm so desperate)

Started by
0 comments, last by NewbZach 4 years, 6 months ago

My constraint solver for 2 obb obb rigidbodies isn't solving properly when affected by gravity as seen here https://ibb.co/qCNxnLg. It also doesn't solve instantaneously (solidly) when bouncing off each other, there is always a slight "penetrating bounce".

I spent the last 2 days mulling over Box2D lite and Randy Gaul's qu3e lite but I can't seem to find the fix nor what I'm doing wrong.. I calculate the constraint mass, then I calculate the normal impulse, and the bias, I then find lambda and then apply contactnormal * lambda * invmass to the body. I'm not sure if it has anything to do with the warming or accumulating of impulses because when I turn it off in Box2D lite it doesn't seem to affect anything.

I'm really not sure what I should be doing, and what I'm doing wrong (which is probably a ton of stuff). My solver is here https://github.com/zacharytay1994/OBBCollisionDetectionResolutionUnity/blob/master/Collision%26PhysicsTest/Assets/Scripts/ResolutionStep.cs starting from line 55. It has a few redundant lines and stuff for my debugging and desperate testing, but the general calculations are there as far as I know. Maybe an experienced eye can take a look or tell me where I am going wrong. I WOULD BE SO GRATEFUL! I will erect a shrine in your name. Thank you!

This topic is closed to new replies.

Advertisement