Link to home
Start Free TrialLog in
Avatar of f15iaf
f15iaf

asked on

collision detection

how do i detect collision between helicopter and very large Ā terrain which contains many mountains in direct3d using delphix.
Avatar of Motaz
Motaz

What did you mean by collision and meshes?
It all depends on how complex your objects are and how many dimensions you are dealing with. A simple solution would be to treat everything as a sphere and then check to see if object 1's 'sphere' intersects with objects 2's.

e.g. Assume that object 1 can be encompased by a sphere of radius 5 and that object 2 can be encompassed by a sphere of radius 10. To check if the two have collided, check the distance between the two (from the centre points) and if it's less than the two radii combined then they have collided. Collision := (iDist <= (r1 + r2))
Calculating iDist can be done with simple Pythagorus: iDist := SQRT(SQR(x1 - x2) + SQR(y1 - y2)) This can be extended to 3 dimensions using the 3D version but I can't remember it off the top of my head

Hope that helps

The Neil =:)
Avatar of f15iaf

ASKER

Edited text of question.
Avatar of f15iaf

ASKER

Edited text of question.
That's right, change the question after I give one of my better solutions

The Neil =>(
ASKER CERTIFIED SOLUTION
Avatar of jeurk
jeurk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial