making a mesh have collision ,

This is a discussion on making a mesh have collision , within the Game Programming forums, part of the General Programming Boards category; say i model a room in 3d max studio then load the mesh in directx and set the material , ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    310

    making a mesh have collision ,

    say i model a room in 3d max studio then load the mesh in directx and set the material , how would i go about making the mesh become part of the world , so like if the player or camera move up a hill or in to the wall , how is that detected , i am starting to think you have to some how get all the vertice cordinates around all the mesh?
    Last edited by Anddos; 08-27-2007 at 04:39 PM.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Say again?

    Are we talking about collision detection?

    To make it part of the world you translate it to it's world coordinates. To do collision detection you can use bounding volumes followed by more expensive per triangle tests.

  3. #3
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Aka, get a book on 3d game programming in your preferred language and API.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    310
    To make it part of the world you translate it to it's world coordinates. To do collision detection you can use bounding volumes followed by more expensive per triangle tests.

    care to say which functions i would need?

  5. #5
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    There are no collision detection functions, you need to compute it yourself.

  6. #6
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    You should type "collision detection algorithms" or something similar into the google search bar.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    310
    i am looking at a function D3DXMeshIntersect , ive looked at some sample code and ran the exe to the sample code , it has 2 mesh's loaded , when you press w it moves forward , now if i walk in to the wall or over a small chunk in the floor it like goes over it and not through it or stops when you come to any 4 sides of the walls , these are the sort of things i mean , i can upload the sample code and exe if you want
    Last edited by Anddos; 08-28-2007 at 10:27 AM.

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Yes you can use the D3DX library for collision detection but those are expensive tests. You need to use some type of spatial partioning system to ensure your game does not become a really fancy slide show.

  9. #9
    Registered User
    Join Date
    Nov 2002
    Posts
    310
    but those are expensive tests.
    what do you mean by this

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Anddos View Post
    but those are expensive tests.
    what do you mean by this
    Expensive in computer terms usually means "takes many clockcycles". In this case, if you have lots of objects to collision detect, you'll need to have a way to separate the ones that are likely to have collisions and the ones that aren't likely to collide, so that you don't have to collision detect all of them. As for how you do that, I don't have a clue (I have some idea about collision detection and 3D graphics, but not enough to know the answer to this).

    --
    Mats

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    43
    Searching google for "Broad Phase Culling" is a good start if you want to find out different strategies for ordering objects for fast collision rejection. Among common options are oc(t)trees, BSPs and various space hashes but there are many ways to do it mostly depending on exactly what kind of objects and what kind of queries you want to do.

    /f

  12. #12
    Registered User
    Join Date
    Nov 2002
    Posts
    310
    which book is good to learn about collisions or picking

  13. #13
    Registered User
    Join Date
    Nov 2002
    Posts
    310
    i dont know if its my compiler or what but i cant seem to load a basic mesh

    D3DXCreateTeapot(D3DDevice , &m_pMesh, NULL);

    this is in the render function
    m_pMesh->DrawSubset(0);

    and its crashing when i try and DrawSubset with a loaded mesh from file , something is wrong and i think its the compiler
    Last edited by Anddos; 08-28-2007 at 10:02 PM.

  14. #14
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    It is probably not the compiler but the compilee.

    Post your code.

    And on a side note we cannot go through every step here in one post to get you up to speed on DirectX/Direct3D and 3D math/algorithms. Buy a book.

  15. #15
    Registered User pronecracker's Avatar
    Join Date
    Oct 2006
    Location
    netherlands
    Posts
    158
    Quote Originally Posted by Anddos View Post
    something is wrong and i think its the compiler
    Course not. Never think that the compiler is wrong. It's the programmer, always the programmer.
    Don't call me stupid.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some collision handling fun
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 04-13-2008, 08:45 AM
  2. Collision Detection Problems
    By Dark_Phoenix in forum Game Programming
    Replies: 1
    Last Post: 12-17-2006, 02:25 PM
  3. need help making a dot bounce up and down y axis in this prog
    By redwing26 in forum Game Programming
    Replies: 10
    Last Post: 08-05-2006, 12:48 PM
  4. collision detection
    By DavidP in forum Game Programming
    Replies: 2
    Last Post: 05-11-2002, 01:31 PM
  5. Replies: 4
    Last Post: 05-03-2002, 09:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21