Sign in to follow this  

question about collision detection

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i can do 2d collisions with no problems, just using x/y. But when it comes to 3d collisions it gets a bit more complicated. Im not sure exactly how it works. Does the screen rotation change anything. For example, if the screen is a birds eye view, or if its more of a warcraft III view. Would those two collisions be the same? Also, if it does matter wat the camera angle is at, could i render teh screen in a birds eye view for simplicity, do my x and y collision detections(which will make it easier to do because ill have x/y collisons for other objects, then z for teh height of the terrain) and change teh angle to any angle i want to make it look the way i want it to look. this would be easier if i could put pictures in the post, so ill try and draw it here... to check colisions i draw the camera looking down...
           camera looking down
              |
        _________
        |        |
        |        | - this is just an object
        |________|
________/        \______________ ground

cameras view

|--------------------   x = left right
|                       y = up down
|   |-------|           z = in out(terrain height)
|   |       |
|   |       |
|   |_______|
|
|____________________


ok so all teh collisions can be done theoretically with great ease because its just like 2d collisions with terrain hieght(stairs and stuff). then if its possible, i can just change the cameras angle at the end to make it look bettter and to use 3d worlds to the maximum potential.
           camera now looking at an angle
              /
        _________
        |        |
        |        | - this is just an object
        |________|
________/        \______________ ground

now supposing this works, i can now have the camera positioned at any angle with out any trouble with the colisions. But this makes things a bit more complex in terms of moving around. How do i figure out where the mouse has clicked in the world? My moving style will be like in Warcraft 3 but with one main guy like in Diablo II. Now if i find out how to find out where i have clicked x/y then moving will not be a problem sense i am moving only in the x/y sense w/o any angle problems. I also just plan on using the box method of colision detection. long post i hope i am clear enough and i hope i didnt ask to much but i have a lot of questions in order for me to fully understand how 3d collisions detection works. thx in advanded jake

Share this post


Link to post
Share on other sites
Well,I supposed that you have no problem with 3D isometrices view and no problem with 2D collosion check

So I Think you have problems with 3D collision detection
check this 3 dimensions

example:

if(abs(box.center.x-box2.center.x))<box1.halfhight.x+box2.halfheight.x) AND (abs(box.center.y-box2.center.y))<box1.halfhight.y+box2.halfheight.y) AND (abs(box.center.z-box2.center.z))<box1.halfhight.z+box2.halfheight.z) Then
return intersection;

about idea is absolute value of the equation of the axis center of the position of box1 minus axis center of the position of box2 is less than the summation of axis halfheitht of both box

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this