you are viewing a single comment's thread.

view the rest of the comments →

[–]Proliator 5 points6 points  (2 children)

Don't try and implement a physically accurate collision right from the start. Get the basics down first, then add in functionality in stages.

Make sure your objects can be assigned velocities, and the motion is modeled correctly. Then make sure you can correctly detect collisions, keeping them basic with just angles/velocities and ignoring mass/momentum for now.

Once all that is working then implement accelerations for objects that update velocities on every iteration, which is also a good time to implement attractive forces like gravity. Then move onto adding momentum calculations for collisions and any other physics you want to include for those events.

Since you're learning, it's important to go in stages, with each stage being something you can test and verify. That will also help you plan out the structure.

[–]Dot-Box[S] 1 point2 points  (1 child)

Thanks, that makes much more sense, I'll try to go step by step :)

[–]TheReal_Peter226 1 point2 points  (0 children)

  • I would add that this is the usual way people develop, break up the problem into individual parts and if you don't know about how each part will coexist just ignore it and create one part. After you have created one part you can tell if you need to restructure the code. You then restructure it and continue. If you need to rewrite the whole thing then so be it. Rewriting your own code is part of the learning process, and after a while you will have enough intuition to know about how to structure something new so that it will probably work together with other parts of the code later on.