Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何相对于屏幕上的位置定位 aSprite和Text实体 。Body我试过body.getPosition().x了,这给出了奇怪的结果。我认为这可能是一个边界问题,因为我只想要显示用于计算的屏幕区域,而不是可用的整个地图空间。
Sprite
Text
Body
body.getPosition().x
您将在物理世界中获得 PIXELTOMETER(PTM)比率中的身体位置。因此,您必须将 PTM 比率乘以身体以获得像素值,如下所示
body.getPosition().x*PTM