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

时间:2014-10-31 19:50:22

标签: math rotation sprite

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

这是描述我想要的图像:

enter image description here

左精灵是精灵在它的自然位置,其他精灵是旋转的。黑点的位置是我想要的(精灵上的位置)。

我知道这可能是一个基本的trig知识所带来的愚蠢问题,但我无法弄清楚。

1 个答案:

答案 0 :(得分:0)

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

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