2017-04-24 18 views
3

私は、そのX軸の上に画像を回転させるようにしようとしているが、そのあなたがバッチでそれを描画するときに、あなたのテクスチャを右に回転させることができlibgdxのx軸上で画像を回転させるにはどうすればよいですか?

Texture one = new Texture(Gdx.files.internal("img/one.jpg")); 
oneImg = new Image(one); 
oneImg.setOrigin(oneImg.getWidth()/2, oneImg.getHeight()/2); 
oneImg.setPosition(stage.getWidth()/2-32 , stage.getHeight()/2); 
oneImg.setScale(2f,2f); 
oneImg.addAction(rotateBy(360, 0.5f)); 
+0

は、1から-1 Y方向にスケーリング、バック正しい(洞)を使用して、x軸の回転角をシミュレートすることができる補間 –

+0

あなたが私に簡単なコードを表示してくださいすることができそれの実装? –

答えて

1

を働いていません。

SpriteBatch.draw(textureRegion.getTexture(), x, y, originX, originY, width, height, scaleX, scaleY, rotation, srcX, srcX, srcWidth, srcHeight, false, false); 

上記のコードは、画像をx軸、y軸、またはその両方で回転させるのに必要な正確なコードです。

ここ2Dに

x - the x-coordinate in screen space 
y - the y-coordinate in screen space 

originX - the x-coordinate of the scaling and rotation origin relative to the screen space coordinates 
originY - the y-coordinate of the scaling and rotation origin relative to the screen space coordinates 

width - the width in pixels 
height - the height in pixels 

scaleX - the scale of the rectangle around originX/originY in x 
scaleY - the scale of the rectangle around originX/originY in y 

rotation - the angle of counter clockwise rotation of the rectangle around originX/originY 

srcX - the x-coordinate in texel space 
srcY - the y-coordinate in texel space 

srcWidth - the source with in texels 
srcHeight - the source height in texels 
関連する問題