有没有办法在SpriteKit中创建凹形PhysicsBody?

编程入门 行业动态 更新时间:2024-10-25 16:23:46
本文介绍了有没有办法在SpriteKit中创建凹形PhysicsBody?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在场上有一个物体,我的英雄不应该穿过它,但它应该能够像进入船上的船一样被其他元素所包围,进入它的内部.我尝试了各种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?

本文发布于:2023-11-24 10:24:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624828.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:凹形   没有办法   SpriteKit   PhysicsBody

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!