首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义SKPhysicsJoint子类

自定义SKPhysicsJoint子类
EN

Stack Overflow用户
提问于 2015-08-14 20:50:33
回答 1查看 124关注 0票数 0

我目前正在使用SKPhysicsJointSpring将多个节点连接在一起。我希望能用对数公式,而不是胡克定律来说明力。

有什么方法可以让我用子类SKPhysicsJoint来提供我自己的力计算吗?或者必须在update(..)中手动实现这一点。

非常感谢,

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-14 21:17:47

您必须“在update中手动”或以其他方式实现它。SKPhysicsJoint及其明显的子类甚至都不是真实的。试着打印一个:

代码语言:javascript
复制
:; 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框架中获得类的实例,并且不能对这些类进行子类分类。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32018452

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档