2015-08-14 53 views
0

我目前正在與SKPhysicsJointSpring一起連接多個節點。我希望能夠使用對數公式來指定力,而不是胡克定律。自定義SKPhysicsJoint子類

有沒有辦法讓我繼承SKPhysicsJoint來提供我自己的力量計算?或者我必須在update(..)中手動執行此操作嗎?

非常感謝,

回答

1

你必須實現它「在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框架得到的類的實例,你不能繼承的類。

+0

啊,這是一個恥辱,感謝您的快速回復! – Mason

相關問題