$12256 / $11500
how do collision is calculated in game?
so that characters dont fall through the floor, stop at walls, and not clip in? maybe also walk on tilted floors and be angled?
do they use placeholders to test the physics? of what kind?
how are these dones, by example, C++ or pythons? C#? lisp?
logically, where are the parameters written between object to object so things connect?
There are many, many different ways to handle collisions in games.
The simplest approach is just to assign each object a rectangle. This is often called a 'collision box'. Then you just check all the rectangles against one another. If any overlap, you have a collision.
If you're looking for a library to save yourself the trouble of writing collision detection routines yourself, try this link:
https://github.com/jslee02/awesome-collision-detection
https://withthelove.itch.io/
Oh wow, amazing.
I definitely want to write it myself,with some adjustments.
thanks for the link, i am browsing it.
so technically, that collission is definitely an overlap in computers? not when the edge touches one another?
> so technically, that collission is definitely an overlap in computers? not when the edge touches one another?
That depends on how you write the tests. If you are using collision boxes, you can write the collision tests to either include the case where the edges touch or not. It's just a matter of how you write the test and wether you use a > or a >= in your comparisons.
https://withthelove.itch.io/
So, i guess you can't really catch a bug and glitch when it happens?
pinpointing the exact mistake?
As someone who has *attempted* to create a collision & physics system, I highly recommend using a pre-built library. There is SO much that you have to do, and it's very difficult to say the least.
Simple collision detection isn't too complex. Using a bounding-box collision system, where you have a square for each collision object is one of the most simple and effective ways of doing collision.
What gets complex is when you have to work out what to do after that.
If two objects collide, do they bounce off of each other? How much friction is applied? How much do the objects weigh, and how does gravity and other external forces affect this? If a character collides with a wall, what actually stops him from clipping through the wall? If the characters velocity is too high or not stopped correctly, your character may get stuck in the wall or floor.
That's not even scratching the surface. There's so much more to think about...
Good luck with it though, let me know how it goes!
(Look at Box2D if you give up ;) )
yeah but which library is good?
you just try every single library for best results?
Base your collision and physics off of a project that's already been done, and find out what physics engine it uses.
Box2D is probably the best library for 2D physics in my opinion. Just look at a tutorial to make it work, cause it is quite complex to implement.
This is a link to a course that teaches 2D Physics. It is of excellent quality.
https://pikuma.com/
Alex McCulloch
When I was learning Javascript, I made some kind of approach to collision:
https://simx72.github.io/Pong/
it isn't actual collision but overlap. The problem is that after some time playing (like 5 min) the ball goes so fast that it would just jump over the paddle and not bounce. The game is in Spanish but its simple pong, controls are w,s for left and up/down_arrow for right. When you get to that point, you'll notice how the ball would just not bounce but pass the paddle as if it was invisible. I never knew how to fix it nor interested about it but since I always use libraries xd, don't know how they work but they do. For physics, which includes collision, gravity, etc, I like phaser.js
Simx72 :)