Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualiedoc

Posted 13 January 2013 - 03:06 AM

if your just doing a simple project, you can just do collision on your own without a 3rd party physics engine.

 

There are many ways to do collision detection. If your rooms happen to be perfectly round like the cylinder you mentioned in your first post, you could get the radius of your cylinder, and just make sure that nothing gets further from the center of the room than the radius, that way you won't be able to walk through the cylinders walls. That's not a very flexible design though, as it would only work well for perfectly round rooms, and if you wanted the rooms to connect, you'd have to find a way to let the player walk to the next room by letting him go further from the center of one room than the radius of that room, if that makes any sense.

 

Otherwise, you can do bounding volume collision tests. There are a lot of different volumes you can use, but common ones include bounding spheres and bounding box's (AABB for an Axis-Aligned Bounding Box or OBB for Oriented Bounding Box). Put your main character or whatever in one of these bounding volumes, and check for a collision between the room and the bounding volume. You could also do triangle to triangle collision tests, Which is the most accurate collision test, however it also takes the biggest performance hit, especially if you have a lot of triangles in your scene to test against, which is why there is bounding volumes. Start with a bounding volume, and if you need to get more accurate, do triangle to triangle collision tests. if you have a lot of things to check for collision with, you might want to do some sort of spacial partitioning, such as a quad tree or octree, so that only an object in a section will check for collision with other collidables in that section and the surrounding sections.

 

Bounding volumes can also include a "collision mesh", which is a representation of the object you want to check for collision with, but many less triangles, and usually convex, so you can use collision test techniques that perform better than collision test techniques using concave objects.

 

if your room is complicated, you'll probably want to create a collision mesh for the room, but if its simply a cylinder, or a box, or some simple shape, you can use it by itself as a collision object with whatever is in the room.

 

Since collision detection is such a common thing in games, you can easily find many many sites that will teach you about collision detection. just use google and you'll find them


#1iedoc

Posted 13 January 2013 - 03:00 AM

if your just doing a simple project, you can just do collision on your own without a 3rd party physicx engine.

 

There are many ways to do collision detection. If your rooms happen to be perfectly round like the cylinder you mentioned in your first post, you could get the radius of your cylinder, and just make sure that nothing gets further from the center of the room than the radius, that way you won't be able to walk through the cylinders walls. That's not a very flexible design though, as it would only work well for perfectly round rooms, and if you wanted the rooms to connect, you'd have to find a way to let the player walk to the next room by letting him go further from the center of one room than the radius of that room, if that makes any sense.

 

Otherwise, you can do bounding volume collision tests. There are a lot of different volumes you can use, but commons ones include a bounding sphere, or a bounding box (AABB for an Axis-Aligned Bounding Box or OBB for Oriented Bounding Box). Put your main character or whatever in one of these bounding volumes, and check for a collision between the room and the bounding volume. You could also do triangle to triangle collision tests, Which is the most accurate collision test, however its also takes the biggest performance hit, especially if you have a lot of triangles in your scene to test agains, which is why there is bounding volumes. Start with a bounding volume, and if you need to get more accurate, do triangle to triangle collision tests.

 

Bounding volumes can also include a "collision mesh", which is a representation of the object you want to check for collision with, but much much less triangles, and usually convex, so you can use collision test techniques that perform better than collision test techniques using concave objects.

 

if your room is complicated, you'll probably want to create a collision mesh for the room, but if its simply a cylinder, or a box, or some simple shape, you can use it by itself as a collision object with whatever is in the room.

 

Since collision detection is such a common thing in games, you can easily find many many sites that will teach you about collision detection. just use google and you'll find them


PARTNERS