gpt4 book ai didi

java - Libgdx,如何像一个纹理一样旋转多个纹理?

转载 作者:行者123 更新时间:2023-11-30 10:29:59 25 4
gpt4 key购买 nike

enter image description here

我想在 libgdx 上像这张图片一样旋转多个纹理。

如何做到这一点?请帮助我。

最佳答案

您可以像对单个纹理一样旋转它们,但是您需要将每个纹理的原点设置为旋转弧的中心(在图像的情况下为左下角),所以一些基本的您需要数学才能正确设置每个纹理,以便较远的纹理围绕与最近的纹理相同的点旋转。

Rotation from origin point example

来自 API:https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/Sprite.html

//Set the origin in relation to the sprite's position for scaling and rotation.
yourSprite.setOrigin(float originX, float originY)

//Sets the sprite's rotation in degrees relative to the current rotation.
//Rotation is centered on the origin set in setOrigin(float, float)
yourSprite.rotate(float degrees)

这些问题和答案可能对您有帮助:

https://gamedev.stackexchange.com/a/75330

https://gamedev.stackexchange.com/questions/119870/libgdx-sprite-rotation-around-specific-point

关于java - Libgdx,如何像一个纹理一样旋转多个纹理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43795270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com