summaryrefslogtreecommitdiff
path: root/platformer/src/render.c
diff options
context:
space:
mode:
authorSchark <jordan@schark.online>2026-09-29 23:36:45 -0400
committerSchark <jordan@schark.online>2026-09-29 23:36:45 -0400
commit8af1210d45c3fa3f41a174d2906ab597dcc22f1c (patch)
tree43f1a9814faae852af943f71de53d4ca38dc6cd2 /platformer/src/render.c
parentfdc8c951fc72d9dc4c8faa58a21b2b9de0599698 (diff)
downloadgamedev-8af1210d45c3fa3f41a174d2906ab597dcc22f1c.tar.gz
gamedev-8af1210d45c3fa3f41a174d2906ab597dcc22f1c.zip
Final state of the game day 3HEADmaster
Diffstat (limited to '')
-rw-r--r--platformer/src/render.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/platformer/src/render.c b/platformer/src/render.c
index 65237f5..3fd2ca6 100644
--- a/platformer/src/render.c
+++ b/platformer/src/render.c
@@ -60,7 +60,8 @@
* floor_y = world_floor_below(body.pos, body.half_width, NULL): the surface
* the player would land on, whether that's the ground or a platform.
* 7. Player box:
- * model = translate(body.pos) * rotate_y(facing_yaw)
+ * model = translate(player_visual_pos()) * rotate_y(facing_yaw)
+ * (body.pos with stair steps smoothed out)
* * scale(2*PLAYER_HALF_WIDTH, PLAYER_HEIGHT, 2*PLAYER_HALF_WIDTH)
* Bright color (e.g. red). Also draw a small second box as a "nose" on
* the front face (+Z in model space) so the facing direction is visible.
@@ -459,7 +460,8 @@ static void draw_shadow(Mat4 vp, const Player *player)
* so you can see which way it faces and tune the turn rate by eye. */
static void draw_player(Mat4 vp, const Player *player)
{
- Mat4 placed = mat4_mul(mat4_translate(player->body.pos), mat4_rotate_y(player->facing_yaw));
+ /* The visual position smooths out stair steps (see player_visual_pos). */
+ Mat4 placed = mat4_mul(mat4_translate(player_visual_pos(player)), mat4_rotate_y(player->facing_yaw));
Mat4 body = mat4_mul(placed, mat4_scale(vec3_make(2.0f * PLAYER_HALF_WIDTH,
PLAYER_HEIGHT,