summaryrefslogtreecommitdiff
path: root/platformer/src/render.c
diff options
context:
space:
mode:
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,