Results 1 to 7 of 7

Thread: tell me some more about collision detection

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    6

    tell me some more about collision detection

    Hello
    i use this openGl forum first time.hope u all are help me here.i read all algorithms about collision detection but could not understand how to apply in my game.my game is gold finder.i load a image and and that move and collide with a gold piece then score incress.this is my theme.plz help me how to apply collision detection in this.can i give you my code??

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    6

    Re: tell me some more about collision detection

    thnx in advance.....

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: tell me some more about collision detection

    in your case the simplest one would be to check the distance between your avatar and each pice of gold, if it's close enough you count it as a hit.

  4. #4
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    6

    Re: tell me some more about collision detection

    thnx 4 reply my question.i made a class of gold and pass the position where it place on the game screen.and moving image is continously move through arrow keys up,down,left or right...then how i find distance between them??this is basic problem .i know.but i m not good in c++ or programming.give idea of thz.i know how to find distance between two points in maths but not at there.thnx if you solve my this problem.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: tell me some more about collision detection

    it's exactly the same, though i suspect that this is not your main problem, that would be trying to make a game without a simple scenegraph, so simply put this is what you should be doing.

    1. the game should run as a simulation
    2. this simulation has objects like gold, enemies, players and cameras with properties such as possition, direction, speed, state and so on.
    3. you change various states(like up-speed if your holding the up key) in it and then evaluate it (ie. making everything move based on these new states).
    4. you then use these coordinates to render everything

    then when this is done you can just use this
    sqrt((a[0]*a[0]) + (a[1]*a[1]) + (a[2]*a[2]))
    to get the distance

  6. #6
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    6

    Re: tell me some more about collision detection

    thnx 4 your coperate..
    i'll try this.in my game camera is not enable till now.now i'll do.and think in a such way.then tell you about my progress.ok

  7. #7
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: tell me some more about collision detection

    This is not an OpenGL question. You could perhaps post this tyope of question to our math & algorithms forum or a more general game programming forum like those on gamedev.net.

    Please restrict posts here to the OpenGL API and topics more directly related.

Similar Threads

  1. Collision Detection
    By ardalanbiz in forum OpenGL: General
    Replies: 5
    Last Post: 02-07-2004, 02:49 PM
  2. Collision detection.... please help
    By Music_Man in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 11-28-2002, 06:38 PM
  3. collision detection
    By imported_robert in forum OpenGL: Basic Coding
    Replies: 13
    Last Post: 02-17-2001, 03:09 AM
  4. collision detection
    By chip in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-08-2000, 07:09 AM
  5. collision detection contest: collision crazy
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-19-2000, 02:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean