#### Archived

This topic is now archived and is closed to further replies.

# collision detection with milkshape models

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

## Recommended Posts

##### Share on other sites
you could use spherical-collision detection.

The way this works is you know the center of each model and the radius of a sphere that would completly fit around the object. Then to collide these two spheres, use sphere one''s radius + sphere two''s radius and use pythagorus to work out if the distance between the centers is less than that value. Then you have a collision.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.

ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Go FAQ yourself ]

##### Share on other sites
ya, the easiest way between two models would be bounding sphere collision detection. if that loading library lets you access the actual vertex data you could look up some other collision detection techniques, such as triangle-plane collision detection. yes, loading the model is the easy part when you have a library for it.

My Homepage
How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.

##### Share on other sites
One way to enclose a set of vertices is to build an axis-aligned bounding box. You can do this easily by going through your vertex data and finding the smallest and largest X, Y and Z values, individually. You end up with two vertices (Xmin, Ymin, Zmin) and (Xmax, Ymax, Zmax) which describe an axis-aligned box that encloses the model.

If you'd rather build a bounding sphere you could add together all of the model's vertices and divide the result by the number of vertices in your model. Make this value the center of your sphere and compute the distance between the sphere's center and each of the model's vertices. Make the sphere's radius the largest of all these distances.

There are better ways to compute bounding spheres and boxes, but I don't know enough to explain how to do that.

[edited by - chronos on November 19, 2002 5:10:19 PM]

##### Share on other sites
I tried this other method with codet - a free collision detection system (www.photoneffect.com/coldet).

Basically all you do is define objects using triangles and move them using matrices. Then you basically ask the system if two models have collided.

What i did was load two models - one i would draw, and i would use the other to define the collision model. I had animation in my demo but i soft of didnt work - i screwed up the matrices but the detection still worked. Anyway if you want a fairly accurate and moderately fast detection system this would work.

-- Rule of Acquisition #59

##### Share on other sites
You can do triangle to triangle collision detection. Thats what I have done. My code loads milkshape3d models and does triangle to triangle checks. I also added bounding boxes (that are calculated on the fly) to speed up the checking process.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

1. 1
Rutin
30
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009494
• ### Who's Online (See full list)

There are no registered users currently online

×