Contents

magneticField()

Creates and returns a field behavior that interacts with charged items.

Declaration

class func magneticField() -> Self

Return Value

A field behavior object that applies a magnetic field to charged items.

Discussion

The magnetic field behavior models a uniform magnetic field in the positive-z direction—that is, coming out of the screen. The amount of force applied by the field is modeled after the second part of the Lorentz equation (F = qvB). When the velocity of a charged item is perpendicular to the uniform magnetic field, the item feels a force normal to both the velocity and the field, resulting in a counter-clockwise rotation. Specifying a negative value for the strength of the field results in a clockwise rotation.

You can use magnetic fields as a way to apply forces to an object that are based on charge instead of mass.

See Also

Getting the field behaviors