Skip to main content
GameDev.net gamedev.net
🔒 Locked

Model-2-Model Collision

Started by ClassifiedOne Feb 14, 2003 at 1:27 PM 3 replies 650+ views
Original Post
ClassifiedOne
ClassifiedOne
Hi, I know there exist many tutorials on collision detection. I have read about bounding boxes, spheres, etc and I now know how a sphere reacts to a plane. But what I don''t know: How do I attach bounding boxes to my model? One simple axis-aligned bounding box seems to be very simple, but what about sub-boxes? How can I attach them to certain points of my model? For example: Let''s say a player punches another one. If his right hand collides with the head of the other player, he should loose some energy. So it would be cool, if you could attach a box with the name "hand" and "head" and then check them both for collision. Since I use the md2 model format and don''t want to write my own, some practical tips for this format would be very nice. Right now, I have a bunch of vertices and don''t know where to start... Thanks a lot ClassifiedOne
Erunama
Erunama
if(CollisionOccured(Model1.Hand(), Model2.Head()))
// take away energy

All you need to do is write a model class that can extract the vertices of a specific body part, and a function to take in two sets of vertices, and see if there are any intersections.

Good luck

|.dev-c++.|.the gimp.|.seti@home.|.dbpoweramp.|.torn.|.=w=.|
ClassifiedOne
ClassifiedOne
quote:
Original post by Erunama
All you need to do is write a model class that can extract the vertices of a specific body part...


Yeah, that''s where I could use some help...
MrTors
MrTors
Well, it''s gonna be kinda hard to get the right verticies from the model for a specific body part without using some type of tool to preprocess that. I''m not familiar with the md2 file format, but I faintly remember it''s something from the Quake series? Those files can have model animation in them correct? It might be easiest for you to just define regions in the model which correspond to the different parts of the body you want to check collision on. You probably don''t want to worry about triangle level collision for now unless you''re dying for accuracy. Though if the model is animating, you may want to attach the bounding region to a vertex in some way so that if the body part translates during the animtion, the region will be in a correct position.... goodluck!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.