XNA Creators Club Online
Page 1 of 1 (18 items)
Sort Posts: Previous Next

Custom Bounding-ThingyMaBob.

Last post 11/24/2009 7:16 PM by TheManWithNoName. 17 replies.
  • 11/21/2009 4:41 PM

    Custom Bounding-ThingyMaBob.

    If you havent already guessed - ThingyMaBob is a newly discovered shape that is random each time its rendered ...

    Im using BoundingSpheres and Boxes for my collision detection systems, but when using objects that arent necessarily spherical I get an issue of false detection in which theres blank space unoccupied by the object.
    Im using 5 different asteroids, and I basically need a Bounding-Thingy to encompass the entire asteroid without 'white-space' if you will. BoundingSpheres have to be either too small or too large to produce barely sufficient results.

    Me and my little brother thought somehow taking texture coordinates and turning that into an array of sorts for use in BoundingBox.CreateFromPoints()....

    Any help?

    Regards,
    Courtney Atkin.

    Ps: I posted this here because I dont have a clue where it belongs ;D
  • 11/21/2009 4:49 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    You're on the right track.  Bounding containers like spheres and boxes aren't meant to be used for narrow-phase collision detection (which you noticed due to extra white space), but broad-phase (ie, do these two objects at all possibly collide?).  If you're working with 3D objects look up mesh collision detection, etc.  That should get you going.
  • 11/21/2009 4:53 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    The system works perfectly currently, though thats to the extent that it works. only just.
    It is 3D objects, so I'll google it and see what I get back.
    Thanks very much!
  • 11/21/2009 4:59 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    TheManWithNoName:
    It is 3D objects, so I'll google Bing it and see what I get back.

    Fixed that for you. ;)

    I would start here. Note that last time I checked Ziggyware was still hacked, so I'd be wary of going onto anything that links you there. (stupid, stupid hackers - leave poor ziggyware alone already!)
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 11/21/2009 5:06 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Yes they should leave poor ziggyware alone, I've found many a useful resource on there.

    That bing search coincidentally is the exact same search I did on google.
    The only information I'm finding is to use BoundSpheres/Boxes to check that to objects are in proximity, and then using Triangle based detection to check for the final stuffs.
    Not very exact, but is EXACTLY what im looking for.
    Luckily my current detection method does the first bit already (detecting proximity and returning a collision), I just need to do the triangle stuff on intersection... but I can't find anything - Normally I'd go straight to Ziggyware (Curse you, you stupid hackers, go make a stupid virus that does nothing or something!... actually don't, just in case I get it xD).

    Dunno if either of you know anything about the subject of per triangle collisions?

    Thanks in advance
  • 11/21/2009 6:40 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    UberGeekGames:
    Note that last time I checked Ziggyware was still hacked, so I'd be wary of going onto anything that links you there. (stupid, stupid hackers - leave poor ziggyware alone already!)
    Last I checked, Ziggyware was fine. I just checked again, and Ziggyware is rerouting to a domain name squatting page for 1&1.com. So either it's been re-hacked with a redirect added, or the web domain lease ran out.
  • 11/21/2009 6:45 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    I checked on the PhishTank database, 1&1 has no listings whatsoever, so it seems legitimate. By now one of the PhishTank super people would have reported it if it was fraudulent.

    Personally, i think its been rehacked.
  • 11/21/2009 7:28 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Odd, earlier this week I had tried it and McAfee blocked several viruses and warned me of content trying to execute itself that didn't have a valid signature. In case anyone doesn't know, 1&1 is a legit web hosting company (that's who I use for my site), so if Ziggyware is hacked it's a strange place to direct people to...

    Could be Ziggy noticed that it was hacked again and took the site down. I hope he gets it back up, that place is a goldmine. :(

    @OP: Ironically, the only ones I know of were on Ziggyware. Bing cached some of the pages, such as this one: http://cc.bingj.com/cache.aspx?q=xna+3d+collision+ziggyware&d=5021667211872464&mkt=en-US&setlang=en-US&w=f940cfaf,69278f8c but I don't know if the downloads work or not.
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 11/21/2009 7:41 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Strange, I'm using Avira Premium and AVG Internet Security 9, and neither of those fired any warnings at me, normally they do.
    As for that Cached page, It seems an interesting sample, however I'll have to wait to look at it as I'm one for downloading, running and seeing if it fits my needs... and then tearing the code apart to learn how it works... Brutally... To Shreds.......


    What is an OCTree anyway? I fail to understand the concept provided by that article.
  • 11/21/2009 7:59 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    An Octtree is a spatial partitioning system where you divide the space volume into eight parts or cubes (similar as quad tree where you divide it on four).
    Each cube can be a leaf or a container for 8 new cubes and so on until a max sublevel count is reached or a min density or even size.
    Oct tre helps you for the broad phase only, sorry. It allows you to quickly cut off extremely large number of checks in child nodes (cubes) if the parent fails the check.
    E.g if you have the complete game world divided into 8 nodes and want to check if something has collided with anything inside that world you check the 8 bounding boxes, for each negative result you automatically discard all the childs contained in the neagtive BB nodes. Iterating only a few levels deeper along the positive paths you can with very small number of checks disregard most of the world objects (even thousands of them) and build a pool of just few potential candidates.

    Now to the original question...
    The above would be just an optimization of your current BB check. You could keep that BB check and build collision pairs (asteroids) or list of multiple objects that are potentionaly overlapping. Once you have a pair or a list you must do thorough inspection whether there is a collision or not. I am afraid that there is no universal approach how this can be done but more or less it all comes down to checking individual triangles both meshes.

    [EDIT] Errr an other option would be to let a physics engine do that for you!
  • 11/23/2009 5:02 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    I have my narrow phase detection, which is a sphere assigned to each object, if the spheres make contact then the asteroid is removed.
    I need broad phase detection, IE: The ship might be overlapping with the asteroids sphere, BUT might not actually have made contact.
    I've looked into OCT Tree's and they look sufficient, but not to my taste. Problem is I have is i can't work out the mesh to mesh collision stuff - As for the physics engine: Can you recommend one that'll do it?

    [EDIT] Am looking at Oops! Framework?
  • 11/23/2009 8:20 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Last time I was looking at jiglib was free and is running on the Xbox.
    PhysX is better and free, runs on GPU (NVidia HW only) but not on XBox (for us mortals, for big bucks it is another story).
    I am not aware that there are other engine which are:
    a) free 
    b) have stable integartors (engines)
    c) have decent (and maintained) language bindings for c#   
    d) are still active

    The above will probably hurt many feelings but note that I am not an expert its just IMHO!

    EDIT: BTW the sphere detection is more fit for a broad phase (even without the OCT or Quad Tree a bounding sphere for each object in the scene is fast enough although not as fast as with the Quad/Oct).
    Narrow phase must be fine grained and must detect suptile collisions. Except checking the meshes on a triangle basis I am not aware of any other technique you could implement.
  • 11/24/2009 1:38 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    EDIT: The screenshot can be found below.
    The screenshot!

    In the image, you can see 2/3 different asteroid types, each a different shape, witha globaly defined BoundingSphere size of 0.15f.
    I need something that either encloses the entire asteroid without whitespace, or I need someone to explain to me how I check the triangles for interesections with another model (Code will be necessary, I've never done that bit before).

    Thanks!
  • 11/24/2009 2:14 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Hmm I see the asteroids, guess the circles arround (or inside) are the spheres you are colliding against.
    Not sure what the white stripes, or boxes are though.
    BTW your SkyBox is to noticeable.

    You can't have something which encloses asteroids perfectly!
    Having a fixed sized sphere is a mistake. Your sphere should be a bit larger than your asteroid size - that is the largest extent from its center. Obviously that will leave you with some volume encapsulated with the sphere but not with the asteroid -> false positives.

    Mesh vs mesh collision is a huge topic. The implementation is usually very game specific. So you need to figure out what your objects are doing and how to check them for collision.

    I would advice you to just implement the sphere check which is in 90% enough and will let you continue developing the game until you figured out what the best solution is.

    Such problems can be solved with Ray vs sphere tracing. The ray is the movement vector of the asteroid with start in the sphere center.
    You could introduce two spheres one outer containing the whole asteroid and one inner contained inside the asteroid. If the ray is intersecting both spheres it is a confirmed positive and no need to check anything. If it intersects only the outer but not the inner sphere...well it depends how perfect it has to be.

    If you really need mesh vs mesh you should split the asteroid into smaller parts, at least 8 and with the ray determine which part can suffer the collision.
    Then you must check all the triangles in that mesh part (hopefully not more then 10-30) and figure out which of them is closest to the other mesh center. Repeat that for the first mesh, figure out which triangle (or an arbitrary but small number of them like 2-4) is closest to the opposite sphere center. Now you have 1 or few triangles in each Mesh and all you need is to check if some of the triangles are closer to the other meshes center than the triangles belonging to the mesh.
    But this is just a proposal without knowing your game environment and requirements.

    All that is complicated and CPU hungry, honestly I doubt that it would work on XBox with more than 2 or 4 very optimized and small meshes.





  • 11/24/2009 3:43 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Look for Charles Humphrey's blog over on the UX XNA site. 

    http://xna-uk.net/blogs/randomchaos/

    He may have just what you want
    http://www.youtube.com/watch?v=4Enqcn1xsHw

    Best,
    Byron
    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 11/24/2009 4:23 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Woah, Not only am I using th source code for your Laserbolt in my game, but I'm also *Attempting* to use the thruster, but it renders inside my ship, a small offset problem - Care to help me?
    For the record - They're both rather amazing.

    Per triangle collision is what I'm trying to achieve yes, but the link you provided me with for the Blog wasn't a direct link to any sample, I've been to Nemo's blog before.
    And after watching the Youtube video - it is EXACTLY what i'm trying to do, But no idea how to do it :(
  • 11/24/2009 5:07 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    I bet if you drop charles an email he'd be glad to help out.   As for the thruster etc, drop an email anytime you've got a question.  I'd love to see what you do with it.  drJBN hotmail com     Glad you like them :)

    Best,
    Byron
    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 11/24/2009 7:16 PM In reply to

    Re: Custom Bounding-ThingyMaBob.

    Yes, the spheres are what I'm checking for collisions with, and the boxes are boundaries that I had no better way to visualize.
    And I'm well aware that my skybox is noticeable, its only a stand in for my development phase though =].

    I'll be sure to drop charles an email and see if he can help.
    I must say I've never seen a more proactively helpful forum!
Page 1 of 1 (18 items) Previous Next