0

Is there a way to change the origin of a Texture/TextureRegion when using the draw call

public void draw (TextureRegion region, float width, float height, Affine2 transform)

in LibGDX?

I'm trying to load an animation which is exported from Adobe After Effects. Currently the transform is exported as an affine 2D matrix and it's just rotation so it's simple, but it may get more complex later so I don't want to just use this call

public void draw (TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

What I've achieved so far is just this (the origin is fixed at 0, 0): http://postimg.org/image/9qxux0sfr/

instead of this (good origin): http://postimg.org/image/pd60zaa89/

Obelisk
  • 23
  • 5
  • What about using a `Sprite` for this? – noone May 16 '15 at 12:10
  • Oh, the drawing is for an animation (contains many frames, with each frame is constructed from many modules which I'm trying to draw, as you see), so I try to keep things in LibGDX's line. I aim to create something like this http://postimg.org/image/4t4wzbyh5/ – Obelisk May 16 '15 at 13:09
  • 1
    Okay... whatever that is, lol. Looks like you are in need of a 2D scenegraph (hint: scene2d). – noone May 16 '15 at 13:19
  • Thanks for mention, noone. I just tried it with Sprite and got the first step! But Sprite still has no call that accept matrix transformation as parameter, maybe I'll consider using spritesheet to complete the game quickly (though its capacity may raise a lot to storing all 60 sprites, one for each frame, exported from After Effect >.<). – Obelisk May 16 '15 at 14:07
  • Usually you'd use a transformation matrix with your `Camera` and your `SpriteBatch` – noone May 16 '15 at 14:09
  • So it is. I'm kind of novice about those things (stuffs in computer graphic & application). Still watching some tutorial of Scene2D, you've guided me the right way :D Many thanks :) – Obelisk May 16 '15 at 20:03

0 Answers0