rot camera vector
This commit is contained in:
parent
dbd8d2c217
commit
8ba694a25a
@ -11,6 +11,7 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
#include <math.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user