Platforms to show: All Mac Windows Linux Cross-Platform

Back to SCNPhysicsFieldMBS class.

SCNPhysicsFieldMBS.customField(FieldForceEvaluator as SCNFieldForceEvaluatorMBS, tag as variant = nil) as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that runs the specified block to determine the force a field applies to each object in its area of effect.

delegate: A method that SceneKit runs for each object in the field’s area of effect.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNodeMBS object.

For custom physics fields, SceneKit ignores the direction, strength, falloffExponent, and minimumDistance properties. Instead, SceneKit calls your block to determine the direction and magnitude of force to apply to each physics body or particle in the field’s area of effect.

Due to the dispatching of the delegate to main thread, this is not very efficient.

SCNPhysicsFieldMBS.dragField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that slows any object in its area of effect with a force proportional to the object’s velocity.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Like the damping and angularDamping properties of a physics body, drag fields can simulate effects such as fluid friction or air resistance. Unlike those properties, drag fields can simulate different intensities of fluid friction in different areas of your scene. For example, you can use a drag field to represent underwater areas.
The default falloffExponent value for a drag field is 0.0, indicating that the field’s effect is constant throughout its area of effect.

SCNPhysicsFieldMBS.electricField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that attracts or repels objects based on their electrical charge and on their distance from the field’s center.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Use this field type to make objects behave differently from one another when they enter a region, or to make an object's behavior different from its mass-based behavior. An electric field behaves according to the first part of the Lorentz force equation modeling real-world electromagnetic forces—the field applies a force whose magnitude is proportional to electric charge and distance.
By default, physics bodies and particle systems have no electric charge, so they are unaffected by electric and magnetic fields. Use the charge property of a physics body or the particleCharge property of a particle system to add charge-based behavior.
When the field’s strength value is positive (the default), it attracts bodies whose charge is negative and repels bodies whose charge is positive. To reverse this behavior, set the field’s strength property to a negative value.
The default falloffExponent value for an electric field is 2.0, indicating that the field’s effect diminishes with the square of its distance from its center.

SCNPhysicsFieldMBS.linearGravityField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that accelerates objects in a specific direction.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Because the force of gravity on an object is proportional to the object’s mass, this force accelerates all objects in the field’s area of affect by the same amount. The field’s strength property measures this acceleration in meters per second per second.
By default, a linear gravity field accelerates objects in along its direction vector. To make it accelerate objects in the opposite direction, set the field’s strength property to a negative value.
The default falloffExponent value for a linear gravity field is 0.0, indicating that the field’s effect is constant throughout its area of effect.

SCNPhysicsFieldMBS.magneticField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that attracts or repels objects based on their electrical charge, velocity, and distance from the field’s axis.

A physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Use this field type to make objects behave differently from one another when they enter a region, or to make an object's behavior different from its mass based behavior. A magnetic field behaves according to the second part of the Lorentz force equation modeling real-world electromagnetic forces—the field applies a force determined by the cross product of an object’s velocity vector and the magnetic field vector at the object’s location, with magnitude proportional to the object’s electric charge.
By default, physics bodies and particle systems have no electric charge, so they are unaffected by electric and magnetic fields. Use the charge property of a physics body or the particleCharge property of a particle system to add charge-based behavior.
When the field’s strength value is positive (the default), the magnetic field vectors circulate counterclockwise relative to the field’s direction vector. (That is, the magnetic field models a real-world magnetic field created by current in a wire oriented in the field’s direction.) To make field vectors circulate clockwise, set the field’s strength property to a negative value.

This SCNPhysicsField option models the real-world physics effect of magnetic fields on moving, electrically charged bodies, not the behavior of permanent magnets or electromagnets. To make objects in your scene simply attract or repel one another, use a different field type. For example, a field created by the radialGravityField method attracts or repels all dynamic bodies near it according to its strength property, and a field created by the electricField method selectively attracts or repels bodies according to their electric charge.
The default falloffExponent value for a magnetic field is 2.0, indicating that the field’s effect diminishes with the square of distance from its center.

SCNPhysicsFieldMBS.noiseField(smoothness as double, animationSpeed as double) as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that applies random forces to objects in its area of effect.

smoothness: The amount of randomness in the field. A value of 0.0 specifies maximum noise, and a value of 1.0 specifies no noise at all.
speed: The field’s variation over time. Specify 0.0 for a static field.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Use this field type to simulate effects involving random motion, such as fireflies or gently falling snow.
In calculating the direction and strength of the field’s effect on an object, SceneKit uses a Perlin simplex noise function. This function produces a velocity field that varies over time.
The default falloffExponent value for a noise field is 0.0, indicating that the field’s effect is constant throughout its area of effect. This field type ignores the field’s direction property.

SCNPhysicsFieldMBS.radialGravityField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that accelerates objects toward its center.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Because the force of gravity on an object is proportional to the object’s mass, this force accelerates all objects at the same distance from the field’s center by the same amount. The field’s strength property measures this acceleration in meters per second per second.
By default, a radial gravity field attracts objects toward its center. To make it repel objects instead, set the field’s strength property to a negative value.
The default falloffExponent value for a radial gravity field is 2.0, indicating that the field’s effect diminishes with the square of distance from its center.

SCNPhysicsFieldMBS.springField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that pulls objects toward its center with a spring-like force.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

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 falloffExponent value for a spring field is 1.0, indicating that the field’s effect diminishes linearly with distance from its center.

SCNPhysicsFieldMBS.turbulenceField(smoothness as double, animationSpeed as double) as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field that applies random forces to objects in its area of effect, with magnitudes proportional to those objects’ velocities.

smoothness: The amount of randomness in the field. A value of 0.0 specifies maximum noise, and a value of 1.0 specifies no noise at all.
speed: The field’s variation over time. Specify 0.0 for a static field.

Return a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

Like a noise field, a turbulence field applies forces in random directions to the objects that it affects. Unlike a noise field, a turbulence field applies a force whose magnitude is proportional to the speed of each affected object. For example, an object passing through a noise field shakes as it travels through the field, but an object passing through a turbulence field shakes more violently the faster it travels. The field’s strength property scales the magnitude of the turbulence effect.

The default falloffExponent value for a turbulence field is 0.0, indicating that the field’s effect is constant throughout its area of effect.

SCNPhysicsFieldMBS.vortexField as SCNPhysicsFieldMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a field whose forces circulate around an axis.

Returns a physics field object. To use the field in a scene, attach it to the physicsField property of an SCNNode object.

The force on an object in a vortex field is tangential to the line from the object’s position to the field’s axis and proportional to the object’s mass. (The field’s axis is a line that is parallel to its direction vector and that passes through its center. For details, see the offset property.) For example, when a vortex field’s area of effect contains many objects, the resulting scene resembles a tornado: The objects simultaneously revolve around and fly away from the field’s center.
By default, a vortex circulates counterclockwise relative to its direction vector. To make it circulate clockwise, set the field’s strength property to a negative value.
The default falloffExponent value for a vortex field is 0.0, indicating that the field’s effect is constant throughout its area of effect.

The items on this page are in the following plugins: MBS Mac64bit Plugin.


The biggest plugin in space...