0
我正在制作一个游戏,玩家应该朝它的方向移动。 所以我想出了这个。为什么xspeed!= 0?
int speed = 50;
float rotation = 90;
int speedx = speed * cos(rotation);
int speedy = speed * sin(rotation);
player->move(speedx, speedy);
但问题是这样的:cos(90)
回报-0.448074
和sin(90)
回报0.893997
。他们应该返回0
和1
。
你们有没有想法为什么?
你在写什么语言?请将其添加为标签。 – Polyov