Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Change a vertices and display corner of a polygon

$
0
0

I’m currently building a level editor for my game and i’m having some trouble on how to change vertices of a polygon.
Basicly i searched the web trying to figure out how to update the vertices of a polygon and everytime people keep saying that you have to destroy the fixture of your body and recreate a new one with the new coordinates. Is there another way the change that ? I only want to update one vertices, for example if i click on the top left of my rectangle, drag it somewhere, the top left corner will follow my mouse and change the rectangle.

Another question is how do i display the vertices of my polygon ? When i click on a polygon, my camera is put on the center of it and i’d like to display each vertices with a square showing to the user that on a simple click-drag he can move a vertices. I have make a little drawing of my question :

big paint skillzz
(apologies for my great paint skills :) )

Do i have to display n-sprites (depending on how much corner i have), and put a listener on them ?

Thanks for your help !


Viewing all articles
Browse latest Browse all 434

Trending Articles