Jump to content
  • Advertisement
isu diss

How do I stop sinking and sliding objects?

Recommended Posts

I changed to OBB from AABB. Here's the latest arbiter.cpp/.h. @Irlan Robson Can you look at this code too pls? If I can create good contact points, this whole problem could be solved. The problem with AABB was contact generation; the ball behaved as expected but stumps did not, they started to slide down the ground.

Arbiter.cpp

Arbiter.h

Share this post


Link to post
Share on other sites
Advertisement

You're just guessing! It can be anything.

If you can't solve a problem then there is a simpler problem you can solve. Therefore, my suggestion is to simulate a vertical stack of spheres falling over a stationary plane under gravity. This is what I did a long time ago.

Simulating AABBs can make you blindly debug rotations since they can't rotate. Spheres can rotate.

Ensure the collision detection and contact generation code for spheres on a plane is working. Fortunately in collision detection you can visualize everything. Happily it's pretty easy to render a plane and a sphere. Be simple. You don't need to render textures or anything like this. 

After everything is working debug the contact solver. Your contact solver code seems to have no troubles. Then debug the friction solver. 

This is how engines are created. One feature at a time sorted by importance. Understand it, implement it, test it out, then debug it. It seems you're trying to solve multiple problems at once. Solve one problem at a time. Otherwise you're chasing waterfalls.

Share this post


Link to post
Share on other sites

Thank you sir for your valuable suggestions. I used Randy's working qu3e's obb code. I tried to find the problem but I couldn't find any. This is what happens in the simulation -

Here's the arbiter code.

Arbiter.cpp

Arbiter.h

Share this post


Link to post
Share on other sites

It's difficult to guess what the problem is. It seems it is a numerical problem, maybe a division by zero, or maybe you're not initializing some variable. You will need to debug this. Pay attention to the compiler warnings.

Again, my suggestion is to do spheres on plane because CD is like 10 lines of code in that case. It will be highly easy to debug this.

Share this post


Link to post
Share on other sites

Before I try what you said earlier, I decided to use my first AABB-AABB code for once. It is much promising than OBB-OBB code. AFAIK the ball deviates as expected due to friction still stumps' have got problem. Here's the video.

 

Share this post


Link to post
Share on other sites

I think I found the problem. When I changed the order of adding objects(adding ball before ground) into the physics system, the ball too didn't get resolved. If I add the ground first then add other objects ball gets resolved, bails get resolved. As far as I understood, My broad phase is  the culprit. How to make a good broad phase???

World.cpp

World.h

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!