• entries
    222
  • comments
    608
  • views
    588282

Bounding Box Bouncing

Sign in to follow this  
benryves

1048 views

I've updated the collision detection between points and the world with Scet's idea of only testing with the faces in the leaf containing the start position of the point.



ZiggyWare's Simple Vector Rendering GameComponent is being very useful for testing the collision routines. [smile]

I have also extended the collision routines to bounding boxes. This fixes a few issues where a point could drop through a crack in the floor between two faces.



My technique is to test the collision between the eight corners of the box and then to pick the shortest collision and use that as the resultant position. This results in a bounding box that is not solid; you can impale it on a spike, for example.



In the above screenshot, the cube comes to rest with the corners all lined up on cracks, which means that it slips through as its base isn't solid.



Happily, object collisions are simple bounding-box affairs, the bounding boxes set with QuakeC code, which should simplify things somewhat.
Sign in to follow this  


2 Comments


Recommended Comments

How much better is performance when using the BSP Tree? I'm guessing it scales better as well, that is it takes the same amount of time regardless of how big the level is.

Share this comment


Link to comment
Quote:
Original post by Scet
How much better is performance when using the BSP Tree?
In normal use, there is no difference in the stock maps* (still about a constant 95FPS). For gigantic maps (ie iam1.bsp) it returned to about 95FPS from 70FPS. The bottleneck is my very inefficient rendering (lots of redundant state changes and texture swapping). Testing with more than one collision would also help.

One place where it has noticably helped is where a vertex gets lost outside the map, where in certain positions something very strange would happen and the framerate would drop to 3FPS. By implementing your fix (to only use the source position to find the faces surrounding the point by its leaf) it stays constantly high. The reason for the massive slowdown was no terminal velocity on the gravity added to the point, eventually creating a massive bounding box for the point's movement that contained most of the world's faces resulting in a very slow per-face test rather than usual quick bounding-box test discard.

* Not that I'm ungrateful for the idea, it makes the code a lot nicer - especially as it took about five lines of code to change.

Share this comment


Link to comment

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