ios - 更改 SKPhysicsBody 参数无效

标签 ios swift sprite-kit

我尝试模拟不同类型球(足球、网球、高尔夫、 Volley 等)的行为。为了这些目的,我试图改变物理体的密度、质量、尺寸参数。 在我的游戏中它没有效果,我试图在非常简单的应用程序中模拟它,包括球和 Racket

enter image description here

无论质量、密度、大小如何,球总是以相同的速度上升到相同的高度

setting for the ball

enter image description here

这是因为恢复原状等于 1 吗?如何以这种方式模拟不同球类型的行为?

最佳答案

您需要更改恢复属性以及 Lin。阻尼和昂。每个球的阻尼

以我为例

网球 - 静止 0.6 线 0.2 角 0.2

足球 - 休息。 0.5 林 0.3 角 0.2

高尔夫球 - 静止 0.8 lin 0.3 ang 0.3

铅球 - 休息 0.1 lin 0.1 ang 0.1

enter image description here

这里是 Apple 属性定义的链接

https://developer.apple.com/documentation/spritekit/skphysicsbody/1519906-mass

关于ios - 更改 SKPhysicsBody 参数无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45129261/

相关文章:

ios - MVC : Is it a "good practice" to pass a model from a ViewController to another?

ios - 在 SKLabelNode 中识别触摸的问题

Swift/SpriteKit - 碰撞和对象

ios - 施加的力使节点保持移动

iphone - 在 iOS 上从横向 View 切换到纵向 View

ios - 无法跨多个 iOS 设备同步 Amazon Cognito 数据集

ios - iOS MultipeerConnectivity 框架中的 session 加密

ios - Swift:异步数据任务永远不会终止

ios - 如何在 Swift 中获取选定行的值?

ios - 无法使用 removeFromParent : Swift 删除点击的 spriteNode