I’m implementing a dragging ui panel, but as soon as I call the translate method the panel flies away.
It moves of one full screen size when I call .translate(1, 0, 0)
Do you know why and how to do it properly?
I could try a workaround and divide the movement value by the canvas size but looks a bit hacky.
I’ve modified local position directly as shown here: https://playcanvas.com/editor/code/475452?tabs=7675637
See _onTapsMove
1 Like
Thank you, but translate internally just do setPosition.
Instead, I saw you are using setLocalPosition.
As soon as I changed .translate
into .traslateLocal
it worked.
It makes sense, as the 2D Screen entity probably uses a normalized coordinates.