Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Math 获取精灵的顶部中心,调整旋转?_Math_Rotation_Sprite - Fatal编程技术网

Math 获取精灵的顶部中心,调整旋转?

Math 获取精灵的顶部中心,调整旋转?,math,rotation,sprite,Math,Rotation,Sprite,我有一个小正方形的精灵,我需要根据旋转得到精灵的顶部中心 这是一张描述我想要什么的图片: 左侧精灵是处于其自然位置的精灵,其他精灵将旋转。黑点的位置是我想要得到的(精灵上的位置) 我知道这可能是一个愚蠢的问题,但我不能理解它 我明白了,下面是我的解决方案: x = (float) (PlayerEntity.getPos().x + Math.cos(Math.toRadians(PlayerEntity.getAngle()))); y = (float) (PlayerEntity.get

我有一个小正方形的精灵,我需要根据旋转得到精灵的顶部中心

这是一张描述我想要什么的图片:

左侧精灵是处于其自然位置的精灵,其他精灵将旋转。黑点的位置是我想要得到的(精灵上的位置)


我知道这可能是一个愚蠢的问题,但我不能理解它

我明白了,下面是我的解决方案:

x = (float) (PlayerEntity.getPos().x + Math.cos(Math.toRadians(PlayerEntity.getAngle())));
y = (float) (PlayerEntity.getPos().y + Math.sin(Math.toRadians(PlayerEntity.getAngle())));