#### Archived

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

# Help with collision.

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

## Recommended Posts

hi again, one more question can someone help me to make collisions between ms3d(buildings) models and md2 model(character), explain or some tutorial links or something like that. thx,

##### Share on other sites
Well you cant just have a bunch of models thrown together and have them collide, there is a fair bit of work involved.
You''ll need some form of spacial division be it BSP, OCTREE, whatever. Ontop of that you''ll want something like AABB for moving ents, such as your md2 models for inital collision, then probably smaller boxes/spheres, maybe even polygon collision for further refinement. Your going to need to generate planes for your terrain (ie buildings) to test collision against.
You have a lot of work to do.

##### Share on other sites
This may help. You''ll need a deep insight of linear algebra to understand how this works. I tell you this because I didn''t understand it very well at first. I had to blow the dust from my university books... Collision detection is mostly about this stuff. Just don''t give up on it.

##### Share on other sites
it''s not easy. the simplest you can do, for a try, is with simple spheres. sphere-sphere, for character, then sphere-triangle....

it works like this. find the point on the triangle the closest to the sphere centre. check if the point is inside sphere. if it is, push the sphere away from the point so the point stays outside the sphere.

##### Share on other sites
heh, oliii, You''re becoming the guardian angel of the collision-detection-illiterates like me (thanks god!)

oliii helped me with my collision detection algorithm here. Also a good read. His sample source is quite usefull too.

##### Share on other sites
ta
since I'm stuck with a mild flu, I had time to make some improvements to the demo above.

added an AABBtree. Yay! now the demo is complete.

[edited by - oliii on March 20, 2004 1:42:07 PM]

##### Share on other sites
The format of the models doesn''t matter, since once they''re in the engine they''re all just a bunch of polygons anyway (At least as far as your collision detection system is concerned).

However, as the other posters said, colliding two meshes against each other is very slow and complex endeavor, and collision response in those situations isn''t obvious at all. In other words, you really should be colliding simple primitives (spheres, boxes, etc.) against meshes instead. For instance, your main character might be a sphere or an ellipse and you''d collide that against the world mesh.

----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
"If you have any trouble sounding condescending, find a Unix user to show you how it''s done." - Scott Adams
FaceHat Software -- Wear the hat.

##### Share on other sites
quote:
Original post by The Senshi
... and collision response in those situations isn''t obvious at all.

I underline this...

Go with boxes and spheres...

1. 1
2. 2
Rutin
22
3. 3
4. 4
5. 5
frob
12

• 17
• 9
• 31
• 16
• 9
• ### Forum Statistics

• Total Topics
632615
• Total Posts
3007441

×