You are browsing as a guest. Sign up (or log in) to start making projects!

2h 0m 38s logged

Dev Log #13.Unlucky for some, but not for me!
.
Collision resolution finally working!!!!
.
Here’s how it works:
.
SAT algorithm returns the axis with the smallest overlap (this is the shortest distance to separate the player and the tile).
.
Correct normal line direction so that it points from the tile to the player.
.
Move player across MTV (Minimum Translation Vector), pushing player out of the tile. Note: MTV is calculated by choosing the smallest overlap in the direction that moves the two shapes apart.
.
Remove velocity that is parallel to the collision surface, allowing the object to glide across it without getting stuck.
.
That’s the jist of it. There are some other things I didn’t include, like how only polygons are made for tiles touching the player’s polygon/rect, but I discussed this in a past dev log.
.
In all honesty, I don’t fully understand the maths behind it, but I was still able to make my own SAT collision system, so I obviously know enough.
.
Also added some smaller things like a bullet limit and a restart caused by holding the R button down.
.
This is good progress and should allow me to add more easily things like level select, new Tiled maps, new tile variants that cause different effects, etc.
.
Next dev log is going to be packed with stuff!!!!.See you then (;

0
29

Comments 0

No comments yet. Be the first!