LeSam
LeSam

Reputation: 1265

Libgdx Sprite's position relative to the SpriteBatch's position

I wonder know how to do for set a sprite that is following the spritebatch's Vector position :

Vector3 position;
Matrix4 camera;
SpriteBatch batch;

...
//Some code
...

position.set(-1, 0, 0);
camera.setTranslation(position);

batch.setProjectionMatrix(camera);

so I got a sprite and I want that the sprite alway stay at the same position Relative to the SpriteBatch's position.

Upvotes: 0

Views: 337

Answers (1)

Daahrien
Daahrien

Reputation: 10320

spriteBatch does not have a position. Do you mean relative to camera's position?

use something like: camera.position.x+(your relative position e.g. +100, or -80) and the same for y.

Upvotes: 1

Related Questions