Results 1 to 3 of 3

Thread: Translated 2d Ball collision code problem

  1. #1

    Translated 2d Ball collision code problem

    Hello i have translated the 2d ball collision code from flash (action script) taken from this page to pacal, but code does not work..
    see the code here or download the project with a binary included here

    The collision is detected, but nothing is made :? i really don't know where is the problem

    I revised the code three time and don't see anything wrong

    Need some help please :?
    From brazil (:

    Pascal pownz!

  2. #2

    Translated 2d Ball collision code problem

    Here's fix
    http://pastebin.com/m640127ea

    There was small typo in mass formula i think, and recursive for loop for collision is changed. Also replaced sqrt and power functions with built in hypot function for simplicity and speed.

    ...

    After testing i noticed it still doesn't work well when gravity is applied with several more balls. That's when they start to move along edge of each other and slightly inside. Anyway i've never managed to make collision this realistic myself.

  3. #3

    Translated 2d Ball collision code problem

    Quote Originally Posted by User137
    Here's fix
    http://pastebin.com/m640127ea

    There was small typo in mass formula i think, and recursive for loop for collision is changed. Also replaced sqrt and power functions with built in hypot function for simplicity and speed.

    ...

    After testing i noticed it still doesn't work well when gravity is applied with several more balls. That's when they start to move along edge of each other and slightly inside. Anyway i've never managed to make collision this realistic myself.
    Yeah i compared the sources, its b1.mass + b1.masss :?
    and the loop logic was broken

    Thx :!:
    From brazil (:

    Pascal pownz!

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
  •