Jump to content
  • Advertisement
Sign in to follow this  
serengeor

AABB swept collision response with voxel world

This topic is 1323 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I followed this tutorial: link and I was able to make it work with 3d voxel world collisions.

But the problem I have is with collision response. I want to make player slide against the wall if he is running against it, but instead he gets stuck at each voxel edge.

That is happening because I am getting normals with AABB swept test from voxels that are a part of the wall. (Yes, I am doing broadphase check first).

WXUmj.png

In the image above is 2d representation of my problem. Voxels are black rectangles, blue one is player, red is swept check area and green lines are normals.

Possible solutions I thought of are: - Merging voxels into bigger collision boxes based on neighbours, but I think that would cause other problems when holes appear and player size increases. - Ignore collision normal if there is neighbour voxel along side normal. This is what I have currently in my code and works fine for sliding against walls while on ground, but fails when falling against them:http://ideone.com/xdsr2d (Btw, the code is dark and full of terrors)

Because there's many voxels in that are colliding and order of collisions (the order of voxels and normals that I receive after aabb swept test) is hardly predictable neither sollution seams to be good enough.

I would appreciate any help because I've been bashing my head around this problem for quite a while.

This originally was posted on http://gamedev.stackexchange.com/ but I thought it would also be good to post this somewhere else.


 

Share this post


Link to post
Share on other sites
Advertisement

You need to find the closest collision first. Then do your collision response against that. Run the collision + resolution again using the time left and new position and velocity.

Share this post


Link to post
Share on other sites

I've read somewhere about this, but I thought it would lead to the same problem when the player would be located exactly at the edge. I'll give it a try.

Share this post


Link to post
Share on other sites

Rather than bring the object exactly to the edge, leave some space between them but also set the velocity opposite to normal to 0. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!