Results 1 to 3 of 3

Thread: well collision

  1. #1

    well collision

    well well well...

    i've got a bunch of triangles and a camera! i want to make some nice and simple sphere collision detection but as it is the first time i ever try collision detection programming i don't really know how to do that.. i'm not the big mathematic genius but i thought of a way to do it: (it sounded good in my ears)

    check all triangles with following=

    get nearest point inside the triangle
    if the length from the camera to the point is 5 or under the move is invalid and i don't move that way!

    is that the easiest way to do it? i just want it so easy as possible (just without bounding boxes which seems impossible to implement at this state) :roll:
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  2. #2

    well collision

    Google for: "triangle+with+sphere+collision+detection".

    If we look at your algo: when performing "get nearest point inside the triangle" - you have already got distance for each of 3 vertices to your sphere - so if any of these vertices is nearer to sphere - you got it!
    But depending on count of triangles in you scene it's not best idea to check EVERY triangle agains sphere. So you'll have to use some kind of bounding boxes sometime in future anyway.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3

    well collision

    There's also an (c++) example on http://www.gametutorials.com on how to do a sphere-polygon collision.
    Signature:
    <br />This is a block of text that can be added to posts you make. There is a 255 character limit

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •