我在场上有一个物体,我的英雄不应该穿过它,但它应该能够像进入船上的船一样被其他元素所包围,进入它的内部.我尝试了各种PhysicsBody,使其具有矩形,纹理,路径中具有多边形的主体,但无济于事.我在某个地方读到,不可能有凹入的物理体,而只有凸出的.我真的需要它能够凹进去.有人知道如何解决这个问题吗?
I have an object on scene and my hero should not go through it, but it should be able to go inside of it, like a boat into the bay, surrounded by the other element. I tried all kinds of physicsBody having it have body with rectangle, texture, with polygon from path, but to no avail. I was reading somewhere that it is not possible to have a concave physicsBody, but only convex. I really need it to be able to be concave. Does anyone know how to resolve this?
推荐答案您可以通过将一堆凸形物理体合为一个形状来创建凹形物理体.然后,您可以将它们作为子代添加到SKNode,以便它们粘在一起.有一些物理学编辑器应用程序可以帮助您完成此任务,因此您无法手动编写一堆坐标.
You can create a concave physics body by adding up a bunch of convex physics bodies into one shape. Then you can add them as children to an SKNode so that they stick together. there are some physics editor apps that can help you do this so you arent writing a bunch of coordinates by hand.
更多推荐
有没有办法在SpriteKit中创建凹形PhysicsBody?
发布评论