5 ms·
As a non-game-programmer, the idea of "collision detection and prevention" seems like a case of bad modeling. In the real world, two objects don't start by occ
by riprowan 11y ago
As a non-game-programmer, the idea of "collision detection and prevention" seems like a case of bad modeling.
In the real world, two objects don't start by occupying the same space, then deciding that's not a valid state and taking corrective action.
- jon-wood 11y agoIts less a case of them occupying the same space, and more one of each object running its movement code and stating where it would like to be in the next frame. Collision detection then takes place, finds that two objects want to share the same position, and notifies the object of that fact so that it can compensate. That compensation might take the form of changing velocity, blowing into a hundred pieces, or just outright ignoring the fact and carrying on.
- riprowan 11y agoBut in the example, the character in the game actually is moved to the invalid location, then the test is run for invalidity. Not sure why I'm downvoted, this seemed like a reasonable objection to me. Like I said I'm not a game dev.
- Kiro 11y agoCan someone explain why I cannot just check for collision before moving the character?
- GFK_of_xmaspast 11y agoWhat sort of approach do you suggest as an alternative.