I am new to libGDX.I just want a Rectangle or a small curve drawn between the object and the clicked position .I know libGDX has RECTANGLE class.
I just want to draw a rectangle or a curved line to be drawn between the object and the clicked position like this >>>
- click can occur anywhere inside the circle region(above red object or below the red object).
- green cross represents the click position.
- red one represents the object.
Problem is if i use
shapeRenderer.rect(x, y, width, height); it will give me straight horizontal rectangle like the gray rectangle shown in the image. Therefore i will have to use
shapeRenderer.rect(x, y, width, height, originX, originY, rotation); . I gave
0 for both
originY but what will be the rotation value ? I am stuck up in calculating the rotation value .
Currently i can think of two ways to do it :-
- By using Rectangle >>>
shapeRenderer.rect(x, y, width, height, originX, originY, rotation);
- By using sprite image >>>
batcher.draw(region, x, y, originX, originY, width, height, scaleX, scaleY, rotation, clockwise);
But in both the cases as u see i need the rotation value .How to calculate that ?
Or is there any other way we can achieve the same results maybe by using some sprite image or something ?