Reputation: 271
I'm currently working with SKPhysicsJointSpring
to connect a number of nodes together. I'd like to be able to specify the force using a logarithmic formula, rather than Hooke's law.
Is there a way for me to subclass SKPhysicsJoint
to provide my own force calculations? Or must I implement this manually in update(..)
?
Many thanks,
Upvotes: 0
Views: 130
Reputation: 385600
You have to implement it “manually in update
”, or some other way. SKPhysicsJoint
and its apparent subclasses aren't even real. Try printing one:
:; 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>
You actually get instances of classes from the private PhysicsKit framework, and you can't subclass those classes.
Upvotes: 1