有没有一种简单的方法可以从图像中绘制 SKnodes 障碍物的坐标?

is there a simple way to draw coordinates for SKnodes obstacles from images?

我正在创建一个游戏,我需要根据级别(背景图像)在(SKNodes)中绘制一些障碍物。 假设我有一棵树,我想在它周围绘制边框,如下图所示:

我需要坐标来创建物理体。

有简单的方法吗? (也许是软件?)

我需要为不同的设备调整相同的坐标,因此我认为手动操作太复杂了。

有什么想法吗?

谢谢!

看看这个 SKPhysicsBody Path Generator

您可以使用此工具轻松创建您想要的路径(但请务必阅读右上角的规则)

有一个 SKPhysicsBody class 方法可以提供帮助:

+ bodyWithTexture:size:

来自描述:

Use this method when your sprite has a shape that you want replicated in its physics body. The texture is scaled to the new size and then analyzed. A new physics body is created that includes all of the texels in the texture that have a nonzero alpha value. The shape of this body attempts to strike a good balance between performance and accuracy. For example, fine details may be ignored if keeping them would cause a significant performance penalty.