Collision Responses (Physics)
I'm working on physics for SortaCraft once again. My original version of "physics" wasn't very realistic, so I'm trying to improve on it.
I can tell if the player is inside something or not with
Raycast.fromCamera(), but movement doesn't feel very real (e.g sliding along blocks inside of just preventing movement)
What should I do to make "realistic" physics?
As I said above, I can check for a collision, and update the player position (ignore controls, these are independent)
Here's a good example: https://repl.it/talk/share/MineKhan-Minecraft-for-Khan-Academy/87382
If you wanted to implement sliding past things, rather than moving the player object in terms of manually changing player position, apply a force in the required direction.
@tussiez CannonJS has one, if you're using that:
applyForce(force , worldPoint)
Defined in src/objects/Body.js:637
Apply force to a world point. This could for example be a point on the Body surface. Applying force this way will add to
The amount of force to add.
A world point to apply the force on.