diff --git a/src/parser/parse_map.c b/src/parser/parse_map.c index 006e4f6..76a2425 100644 --- a/src/parser/parse_map.c +++ b/src/parser/parse_map.c @@ -11,6 +11,7 @@ /* ************************************************************************** */ #include "cub3d.h" +#include t_vec2 parse_dir(int x, int y) { @@ -37,6 +38,8 @@ int parse_player(t_game *game, int y, int x, char c) player->dir = parse_dir(0, -1); else if (c == 'W') player->dir = parse_dir(-1, 0); + + player->camera = rot(player->dir, 0.5f * M_PI); return (SUCCESS); } diff --git a/src/player.c b/src/player.c index 74dac8b..6ef9f6c 100644 --- a/src/player.c +++ b/src/player.c @@ -53,6 +53,7 @@ static void rotate(t_player *player, float rot_speed) // // player->dir.x = player->dir.x * cos(rot_speed) - player->dir.y * sin(rot_speed); // // player->dir.y = old_x * sin(rot_speed) + player->dir.y * cos(rot_speed); player->dir = rot(player->dir, rot_speed); + player->camera = rot(player->camera, rot_speed); } void player_update(t_game *game, float delta_time)