Closed maneeshbhunwal123 closed 6 years ago
The updateAndRender method can cause the reset of viewport to default one - thus your FitViewport breaks, so if your are setting in it show()
, for custom viewports add use of the:
rayHandler.useCustomViewport(x, y, width, height);
A few more details are on this Wiki page.
@rinold Thanks for your quick response, I tried
@Override
public void show() {
viewport = new FitViewport(1080, 720);
stage = new Stage(viewport);
rayHandler.useCustomViewport(0, 0, 1080, 720);
}
But this also is not working? Can you please help, what these values should be, if not these?
Thank you very much.
Try using the viewport you create, may be it's different from the 1080x720 - e.g. like so:
viewport = new FitViewport(1080, 720);
rayHandler.useCustomViewport(viewport.getScreenX(),
viewport.getScreenY(),
viewport.getScreenWidth(),
viewport.getScreenHeight());
Thanks @rinold , saved my day.
Have a nice day! :)
I am trying out Libgdx, and I have an actor which performs some action whenever we click on it. So far it is working fine. Now I want to add light to the actor. After doing some research I came across Box2DLights. When I tried adding it to my project onClick Actor which was working fine does not seem to work. I am pretty sure this is due to rayhandler/Box2DLights because that is the only change I am making. here is the minimal change that I made to include Box2DLights.
Now When I debugged, I realised the the onClick is
working little below the actual actor , that means somehow the coordinates sifted(I know weird). Can you please help? I also asked this question here on stackoverflow https://stackoverflow.com/q/48488569/4239538