Creates a field that pulls objects toward its center with a spring-like force.
SDKs
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
Framework
- Scene
Kit
Declaration
class func spring() -> SCNPhysics Field
Return Value
A physics field object. To use the field in a scene, attach it to the physics
property of an SCNNode
object.
Discussion
The force a spring field applies to objects in its area of effect is linearly proportional to the distance from the object to the center of the field. (That is, the field behaves according to Hooke’s Law of real-world spring forces.) An object placed at the center of the field and moved away will oscillate around the center, with a period of oscillation that is proportional to the object’s mass. The field’s strength
property scales the magnitude of the spring effect—a larger strength simulates a stiffer spring.
The default falloff
value for a spring field is 1
, indicating that the field’s effect diminishes linearly with distance from its center.