Jump to content

  • Log In with Google      Sign In   
  • Create Account

Collision - BoundingSphere vs BoundingBoxes Corners


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Synthesizer   Members   -  Reputation: 187

Like
0Likes
Like

Posted 13 August 2012 - 07:29 PM

Hi everyone,

I'm working in XNA (C#), & after successfully making my character slide along walls (character represented as a BoundingSphere & wall as a BoundingBox) I've been strugling to solve the well known corner problem.

I've been decomposing the BoundingBox of the wall (AABB) into Planes in order to check which one was hit, descard the further ones, try to work with normals & push the player somehow away from the corner direction (in case it hits the outer part of a corner).
The problem is that there are plenty of different possible situations...

I manage my walls as BoundingBoxes, & each wall is one of them. So in a corner there are 2 BoundingBoxes which come very close one to the other. So there are many planes (outer & inner) that may be hit, from both BoundingBoxes. It's actually very difficult to manage many planes of many BoundingBoxes & get an algorith (which works for inner corners: you are indoors, & outer corners: you out outdoors).

I'll try to show my issue in a pic (seen from above), & I'd like you to help me in thinking about a solution. Is it a mistake to decompose the BB into Planes & work with them individually? (maybe I'm complicating things too much...) May I cast rays...? May I treat the corners with a fixed resolution?
I hope you can guide me somehow, I've really spent a lot of time thinking about solutions & they always match a new case in which they won't work.

Thank you so much,
Synth

P.S.: Oh, I also have an annoying problem in which when I slide along a wall I can see the interior of the "room" (I see across the wall) & I'd like to get rid of this in an elegant way...!

Attached Thumbnails

  • collisionWithWalls.jpg

Edited by Synthesizer, 13 August 2012 - 07:31 PM.


Sponsor:

#2 Inferiarum   Members   -  Reputation: 733

Like
0Likes
Like

Posted 14 August 2012 - 09:37 AM

For a simple scheme, this is how i would do it:

Lets say x is the position of the player and r the radius.

If x is completely inside a box, move it in direction of the normal of the nearest plane until the distance to the plane is r. This should not happen usually.

Else find the nearest point p on each box and move x in direction p - x if norm(p-x) < r.

edit: see e.g. http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/ for more details on the subject.

Edited by Inferiarum, 14 August 2012 - 10:03 AM.


#3 Synthesizer   Members   -  Reputation: 187

Like
0Likes
Like

Posted 14 August 2012 - 06:07 PM

Thank you,
I think the case of the sphere completely inside the box is almost impossible (the wall should be very thick & the player should move very quickly), but I'll analize the other case together with the info you linked. It seems pretty much interesting.

Thanks again,
Synth




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS