The reason of setOrigin doesn't affect Actor's position
See original GitHub issueIssue details
Origin is the center of the object. If origin is outside and object having position (0, 0) it’s logical that origin point must be at (0, 0) and object must keep offset from origin and not only affect rotation/scale but position too.
Reproduction steps/code
Actor actor = new Image("something.png");
actor.setPosition(0, 0);
actor.setOrigin(1000, 1000); // Nothing happened
actor.setOrigin(-1000, -1000); // Nothing happened
Version of LibGDX and/or relevant dependencies
1.9.8
Please select the affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
Another design issue
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
[vtkusers] Problem with vtkActor->SetOrigin() - Kitware
However, when I apply SetOrigin(pos), my actor moves in the scene such > that ... But doesn't SetUserTransform() do that already... the vtk...
Read more >Actor origin in scene 2d - libgdx - Stack Overflow
The position instead is always relative to the lower, left corner and is not affected by the origin. If you want to set...
Read more >Does setScale() affect setPostion() and setOrigin()? - SFML
Any transformations are applied around the origin so rotations rotate around the origin (and that part - the position/origin - doesn't move) and ......
Read more >"How do I ZScript?" - Page 25 - ZDoom forums
This function only alters the position but does not alter the ... If you want to change an actor's position in the world,...
Read more >Actor's location not updating with it's static mesh component
Hi Guys, I have an issue with one of my actors where the location of the actor doesn't change in-game when the actor...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
scene2d
implements a 2D scenegraph and such has different needs than 3D scenegraph that you are probably familiar with. In this context, it makes more sense thatActor
s origin comes into consideration only for scaling and rotation, as it simplifies most operations that deal with position.Most applications of
scene2d
use rectangular actors (UI, platformers, top-down games…) where the point in the center of the rectangle (your suggested origin) is really used only for scaling and rotation, all position/size related logic deals with the rectangle’s corners.This is not a design issue, the design here is sound. One could argue that it shouldn’t be called origin but something like “transformCenter”, as “origin” really does suggest something related to position, but changing that now would break too much code. The documentation on this could be improved though.
You keep assuming that
scene2d
s purpose is to be used like a 3D scene-graph. If that were the case, you would be 100% right. But this is not the case, as I have explained before. Changing this now would break virtually every class in thescene2d.[ui]
packages.I don’t remember ever encountering that. I imagine that doing so will break a lot of existing code, so it can’t be used, in which case why bother with
scene2d
at all?Just because the next version is 1.9.9, it does not mean that next version must be 2.0.0. These dots are just version separators, not decimal points.