java - Using libgdx, how do I reset a PerspectiveCamera without resetting the view so I can correctly rotate the correct axis? -
I am using libgdx. I'm going through the basics so that I just display a box using the following perspective cameras to display a set of latitude and one box:
environment = new environment (); Cam = new perspective camera (67, gdx graphics .getWidth (), gdx. Graphics.getHeight ()); Cam.position.set (10f, 10f, 10f); Cam.lookAt (0, 0, 0); Cam.near = 0.1f; Cam.far = 300f; Cam.update (); Zirokam = New Perspective Camera (67, Gdx graphics .getWidth), Gdx Graphics. GateHight ()); Zerokam. Refinement.Set (10f, 10f, 10f); Zerocam.loket (0, 0, 0); Zerocam.near = 0.1f; Zerokam.far = 300f; Zerocam.update (); I can rotate the box without moving the box using
:
This is in my renderer class:
ModelBatch.begin (zerocam); ModelBatch.render (drawAxis (0), environment); ModelBatch.render (drawAxis (1), environment); ModelBatch.render (drawAxis (2), environment); ModelBatch.end (); ModelBatch.begin (cam); ModelBatch.render (DrawBox (), environment); ModelBatch.end (); Cam.update ();
This is in my screenclass:
Gdx.input.setInputProcessor (new camera input controller);
As you can see that this will rotate the cam
perspective camera and if the zerocam
is not a perceptive camera, the box will rotate again but the axis is constant The problem is that if I have pulled the box, the box is spreading on one side, dragging left / right will still rotate like a clock and will not have a diamond-round-goal. Hope this makes sense.
How can I use the following code in the
Touch dragged (int screen number, int screenwise, pointer pointer)
Basically when I pull left or right, I rotate the box left / right I would like to see what really is happening on cam.
I am heading towards this direction: RotateBox (int x, int y)
in
RenderClass
to my ScreenClass
Calculate how much will rotate.
Public Zero Rotatebox (int x, int y) {Vector3 difvector = cam.position.sub (zerocam.position); Cam.rotateAround (new vector 3 (0f, 0f, 0f), difveector, 1f); }
This just gives me the difference of cam
to zerocam
, but I think this is the right direction. I think I use the X and Y values to calculate the direction to rotate in some direction, and then somehow find the float value to apply a specific axis.
Thanks
Comments
Post a Comment