【发布时间】:2015-08-14 20:50:33
【问题描述】:
我目前正在使用SKPhysicsJointSpring 将多个节点连接在一起。我希望能够使用对数公式而不是胡克定律来指定力。
有没有办法让我继承SKPhysicsJoint 来提供我自己的力计算?还是我必须在update(..) 中手动实现?
非常感谢,
【问题讨论】:
标签: swift sprite-kit skphysicsbody skphysicsjoint
我目前正在使用SKPhysicsJointSpring 将多个节点连接在一起。我希望能够使用对数公式而不是胡克定律来指定力。
有没有办法让我继承SKPhysicsJoint 来提供我自己的力计算?还是我必须在update(..) 中手动实现?
非常感谢,
【问题讨论】:
标签: swift sprite-kit skphysicsbody skphysicsjoint
您必须“在update 中手动”或其他方式实现它。 SKPhysicsJoint 及其明显的子类甚至都不是真实的。尝试打印一个:
:; xcrun swift -framework SpriteKit
"crashlog" and "save_crashlog" command installed, use the "--help" option for detailed help
Welcome to Apple Swift version 2.0 (700.0.52.1 700.0.65). Type :help for assistance.
1> import SpriteKit
2> print(SKPhysicsJoint())
<PKPhysicsJoint: 0x1029006b0>
3> print(SKPhysicsJointSpring())
<PKPhysicsJointDistance: 0x102800530>
您实际上是从私有 PhysicsKit 框架中获取类的实例,并且您不能对这些类进行子类化。
【讨论】: