java - Wrong origin coordinates logic for polygon -


I have a test project now, where I try to fix this problem:

2 polygon objects

2 actors, each actor has a polygon object

1 array with actors, I run in the render method and with the use of size Renderer Draw Polygon < / P>

1 orthographic camera

1 stage

1 screenview

The logic is next: I come only Polygon 1 and Polygon 2 create and 0,0 with the door.

The more I do not set (Gdx.graphics.getWidth () / 2, Gdx.graphics.getWidth () / 2). I translate a polygon by 50 pixels on Axis X and run SetOffin (Gdx.graphics.getWidth () / 2, Gdx.graphics.getWidth () / 2). And I have already added the input listener to the polygon, when I click on it, I rotate with the second polygon with the secondary actor. My camera has a Wi-Up rotation that looks at the second polygon that its origin point is in the top right corner of the screen and rotation around it.

Here is the GIF of the result:

And how it behaves:

And if I maximize the window then its behavior is a GIF: . Here we can see that after resizing, the green polygon rotates around the point which would change the shape of the top right corner of the screen.

There is a test project with this problem

Help to know where the problem is?

Thank you.

It looks as if you misuse the setOrigin method in your code Polygonal Java :

  Make Public Zero () {float w = Gdx.graphics.getWidth (); Float H = Gdx.graphics.getHeight (); // ... p1.setVertices (getVertices (0, 0, 20, 5)); P2.setVertices (getVertices (0, 0, 20, 5)); Getting pa1 = new page (); Gain pa2 = new vector (); Actors.add (PA1); Actors.add (PA2); // ... pa1.setPosition (w / 2, h / 2); // ... pa2.setPosition (pa1.getX (), pa1.getY ()); // ... pa2.setOrigin (pa1.getX (), pa1.getY ()); // & lt; - this line // ... drawerbox (w, h); }   

Origin is not the coordinator of the center of the polygon, but is instead offset

According to your code, both polygons are located at the center of the screen ( W / 2 , h / 2 ).

Then you can set the original of w / 2 , h / 2 for the second polygon, which binds it to the current state and equals and h . In other words, the original is set in the right upper corner of the screen, which is obviously the case.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -