我在玩游戏
ggez
,使用来自
ggez_goodies
.
这架相机只能从图像的左上角旋转,但我希望它从中心旋转。有没有好的方法来定位图像,使其围绕中心旋转?
我想你应该换个位置来解决这个问题,我现在的情况是
只是
职位
self.image
.draw_camera(
camera,
ctx,
graphics::Point2::new(self.position.0, self.position.1),
self.rotation,
)
.unwrap();
我猜一个修复方法会是这样的:
self.image
.draw_camera(
camera,
ctx,
graphics::Point2::new(
self.position.0 + self.rotation_offset.0,
self.position.1 + self.rotation_offset.1,
),
self.rotation,
)
.unwrap();
我认为有偏移是可能的,但我不知道如何根据旋转角度设置偏移。
为了使图像围绕中心而不是左上角旋转,我可以对位置进行什么偏移/更改?