Public Group

# Collision detection - Walls??

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

## Recommended Posts

I've been reading about collision techniques and i think i understand how to use SAT with AABBs which is exactly what i need.. But i was wondering, do i use it with walls too?

I mean.. Let's say i want a player to navigate a maze, do i use a different AABB for every single straight wall segment? How do people usually handle collisions with walls?

Also, What is a good technique to use when the collision detection brought by Bounding Boxes/Spheres is too inaccurate? For example a collision with a tree..

Thanks :)

##### Share on other sites
For the tree, you could create multiple bounding boxes. One for each branch in the tree.

asssaintor

##### Share on other sites
A lot depends on the way your walls are organized.

E.g.: if the walls are alligned to the axis, why use AABBs?
or: if the walls make up a tunnel or road (like in the old Descent games or as in racing games) that is defined by a line through the center of the tunnel or by the edges of the road why not calculate the distance from the line (or edges)to vehicle instead of calculation collisions against wall fragments?

##### Share on other sites
I was in.your same situation and have found success through tile maps.
I open up Photoshop with 32x32 grid lines. I make my level as confined to the grid as possible.
I then open it up with an editor I made, and it exports it to a text file.
The game then imports this text file into an array, format is as follows:
numOfRows numOfCols Pixels
00000
00100
00000

this would make a 5x3 tile map with a solid tile in the middle.
To check for collisions, you simply get all the tiles you are currently standing in and check if surrounding tiles are solid.
If the tile to the right is solid, it's left x coord is your right bound.
I give my player class a bound in 4 directions, and it is constantly updating based on the tile he is on.
It then checks on the playermove function if the move will be within his bounds.
This works quite well with 360 degree motion, only draw back is your art needs to be pretty much on the grid.

Hope I helped

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011790
• ### Who's Online (See full list)

There are no registered users currently online

×