我目前正在SKPhysicsJointSpring
将多个节点连接在一起。我希望能够使用对数公式而不是胡克定律来指定力。
有没有办法让我进行子类化SKPhysicsJoint
以提供我自己的力计算?或者我必须手动实现这个update(..)
吗?
非常感谢,
我目前正在SKPhysicsJointSpring
将多个节点连接在一起。我希望能够使用对数公式而不是胡克定律来指定力。
有没有办法让我进行子类化SKPhysicsJoint
以提供我自己的力计算?或者我必须手动实现这个update(..)
吗?
非常感谢,
您必须“手动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 框架中获取类的实例,并且您不能对这些类进行子类化。