gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 01:06:01 26 4
gpt4 key购买 nike

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

enter image description here

我需要坐标来创建一个 physicsBody。

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

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

有什么想法吗?

谢谢!

最佳答案

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

+ 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.

关于ios - 有没有一种简单的方法可以从图像中绘制 SKnodes 障碍物的坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30097053/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com