Click here to Skip to main content
13,630,992 members
Rate this:
Please Sign up or sign in to vote.
I want to check the collision of one model with another model.I use collision check function as follows:
//Built Bouding Sphere
 private void builtBoudingSphere()
            BoundingSphere sphere = new BoundingSphere(Vector3.Zero, 0);
            foreach (ModelMesh mesh in Model.Meshes)
                BoundingSphere tranformed = mesh.BoundingSphere.Transform(modelTranforms[mesh.ParentBone.Index]);
                sphere = BoundingSphere.CreateMerged(sphere, tranformed);
            this.boudingSphere = sphere;
//Check Collision
 public bool CheckColision(CModel otherModel)
            return (this.BoudingSphere.Contains(otherModel.BoudingSphere)==ContainmentType.Intersects);
//BoundingSphere Property
 public BoundingSphere BoudingSphere
                Matrix worldTranform = Matrix.CreateScale(Scale) * Matrix.CreateTranslation(Positon);
                BoundingSphere transformed = boudingSphere;
                transformed = transformed.Transform(worldTranform);
                return transformed;

The function CheckCollion is great with sphere model but not good with cube or any models because I'm use check BoudingSphere. Can help me check accurate collison? Especially check collision between cubes.
Posted 22-Sep-12 7:47am
Updated 25-Oct-12 7:38am
Sergey Alexandrovich Kryukov 22-Sep-12 22:50pm
It depends on what accuracy do you want to achieve in your engine. What bounding shape do you want to have? If you want more or less realistic shape, the analysis of collisions can become quite difficult.
Sandeep Mewara 23-Sep-12 3:15am
Reply from OP:
Yes, it's very difficult! I plan to split into smaller pieces to review collision.It can be a solution acceptable.
I just sent you a message: you should not re-post; and it cannot help you.
It's extremely unlikely that you could get an answer, especially in this forum. It means a lot of work, really.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Plan to split into smaller pieces to review collision.It can be a solution acceptable. Use BoudingSphere to check that pieces.
Example: the airplane, split: head airplane, tail airplane, wing airplane. And check each part for collision.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03-2016 | 2.8.180712.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100