Results 1 to 7 of 7

Thread: Problem with collision detection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Perhaps you could view your bullets at quantum bullets. Sometimes they're there, sometimes not. Make a feature out of the 'bug'.

    Just kidding of course. Don't know if this is helpful but when I make simple games involving collision detection I make my moving objects round and use the Pythagoras to calculate distance between objects' centers and then compare to sum of radius. Works must of the time unless when I mess up code.

    Good luck.
    Last edited by Jonax; 31-08-2019 at 10:40 AM. Reason: grammar

  2. #2
    in which order do you check the collision? does the asteroid check first or the bullet? I suggest you put your collision detection on the fastest object. also, if the bullet is inside the polygon take it as a collision, even if it didn't hit any lines in between movement positions. that should resolve your troubles.

    EDIT: another thing to have in mind. bullets and asteroids don't dodge each other, they follow straight paths. so, if from one frame to the next, the bullet position cross the path of an asteroid, it's a hit too even if they didn't hit due to small sized asteroid.
    Last edited by pitfiend; 21-08-2019 at 08:02 PM.

  3. #3
    Quote Originally Posted by pitfiend View Post
    EDIT: another thing to have in mind. bullets and asteroids don't dodge each other, they follow straight paths. so, if from one frame to the next, the bullet position cross the path of an asteroid, it's a hit too even if they didn't hit due to small sized asteroid.
    If so, then linear algebra can be used to detect if two trajectories crosses (line v line), or if the bullet trajectory collides with the asteroid (line v circle, line v ellipse or line v rectangle).
    No signature provided yet.

Tags for this Thread

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
  •