Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9216767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:29:13+00:00 2026-06-18T02:29:13+00:00

SpriteBatch batcher = new SpriteBatch(); batcher.draw(TextureRegion region, float x, float y, float originX, float

  • 0
SpriteBatch batcher = new SpriteBatch();
batcher.draw(TextureRegion region,
             float x,
             float y,
             float originX,
             float originY,
             float width,
             float height,
             float scaleX,
             float scaleY,
             float rotation)

What is the meaning of originX, originY, scaleX, scaleY, rotation? Also can you please give me an example of their use?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:29:14+00:00Added an answer on June 18, 2026 at 2:29 am

    Why don’t you look into docs ?

    As stated in docs, origin is bottom left corner, originX, originY are offsets from this origin.
    For example if you want object rotate around his center, you will do this.

    originX = width/2;
    originY = height/2;
    

    By specifing scaleX, scaleY, you scale the image, if you want to make Sprite 2x larger, you will set both scaleX and scaleY to number 2.

    rotation specifies rotation around origin in degrees.

    This code snippet draws texture rotated by 90 degrees around its center

    SpriteBatch batch = new SpriteBatch();
    Texture texture = new Texture(Gdx.files.internal("data/libgdx.png"));
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    
    int textureWidth = texture.getWidth();
    int textureHeight = texture.getHeight();
    float rotationAngle = 90f;
    
    TextureRegion region = new TextureRegion(texture, 0, 0, textureWidth, textureHeight);
    
    batch.begin();
    batch.draw(region, 0, 0, textureWidth / 2f, textureHeight / 2f, textureWidth, textureHeight, 1, 1, rotationAngle, false);
    batch.end();
    

    or take a look at tutorial here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void Draw(SpriteBatch spriteBatch) { for (int x = 0; x < width; x++)
I want to check if the selected rectangle is transparent: spriteBatch.Draw(texture, new Vector2(0, 0),
public Block[,] Layer2ID; Layer2ID[X, Y].Draw(spriteBatch, new Vector2(X * 32, Y * 32)); //Child of
public void Draw(SpriteBatch theSpriteBatch) { Random rand = new Random(); for(int y = 0;
As the title states, I'm trying to resize a Texture2D before even considering SpriteBatch.Draw()
Normally when you do SpriteBatch.Draw you can specify a color. But here's the problem.
Attempting to do SetData() on Texture2D that has been recently Draw()-n by SpriteBatch leads
Well, first of all, my guess is that I'm calling the spritebatch.draw() method to
I'm working on a tile/sprite-based game, calling my Draws via public void Draw(SpriteBatch spriteBatch)
When I'm using the SpriteBatch.Draw() method I can get vertical or horizontal scaling. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.