Platforms to show: All Mac Windows Linux Cross-Platform

Back to SCNPhysicsWorldMBS class.

SCNPhysicsWorldMBS.addBehavior(behavior as SCNPhysicsBehaviorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Adds a behavior to the physics world.

behavior: The behavior to be added.

Physics behaviors constrain or modify the effects of the physics simulation on sets of physics bodies. For example, the SCNPhysicsHingeJointMBS behavior causes two bodies to move as if connected by a hinge that pivots around a specific axis, and the SCNPhysicsVehicleMBS behavior causes a body to roll like a car or other wheeled vehicle.

To use a behavior in your scene, follow these steps:
1. Create SCNPhysicsBody objects and attach them to each node that participates in the behavior.
2. Create and configure a behavior object joining the physics bodies. See SCNPhysicsBehaviorMBS for a list of behavior classes.
3. Call addBehavior on your scene’s physics world object to add the behavior to the physics simulation.

SCNPhysicsWorldMBS.allBehaviors as SCNPhysicsBehaviorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The list of behaviors affecting bodies in the physics world.

SCNPhysicsWorldMBS.Constructor(fireContactEvents as Boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The constructor.


If fireContactEvents is true or you call EnableContactsEvents, we enable the contact events.

A contact is created when two physics bodies overlap and one of the physics bodies has a collisionBitMask property that overlaps with the other body’s categoryBitMask property.

SCNPhysicsWorldMBS.contactTest(body as SCNPhysicsBodyMBS, options as Dictionary = nil) as SCNPhysicsContactMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Checks for contacts between one physics body and any other bodies in the physics world.

body: The body to test for contact.
options: A dictionary of options affecting the test, or nil to use default options. For applicable keys and the possible values, see Physics Test Options Keys.

Returns an array of SCNPhysicsContactMBS objects describing contacts between the specified body and any others, or nil if the body is not in contact with any other bodies.

SceneKit sends messages to the physics world’s contactdelegate object only when collisions occur between bodies whose collisionBitMask and categoryBitMask properties overlap, and only for collisions between certain types of bodies. (For details, see SCNPhysicsBodyType.) Use this method to directly test for all contacts between one body and any other bodies at a time of your choosing. For example, to implement a game with a “wall jump” effect, you could call this method when the player presses the jump button to see if the player character is in contact with any walls.

See also:

SCNPhysicsWorldMBS.contactTest(bodyA as SCNPhysicsBodyMBS, bodyB as SCNPhysicsBodyMBS, options as Dictionary = nil) as SCNPhysicsContactMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Checks for contacts between two physics bodies.

bodyA: The first body (to test for contact with the second).
bodyB: The second body (to test for contact with the first).
options: A dictionary of options affecting the test, or nil to use default options. For applicable keys and the possible values, see Physics Test Options Keys.

Returns an array of SCNPhysicsContactMBS objects describing contacts between the two bodies, or nil if the bodies are not in contact.

SceneKit sends messages to the physics world’s contactDelegate object only when collisions occur between bodies whose collisionBitMask and categoryBitMask properties overlap, and only for collisions between certain types of bodies. (For details, see SCNPhysicsBodyType.) Use this method to directly test for contacts between any two bodies at a time of your choosing. For example, to implement a game where the player character can pick up an item, you might call this method when the player presses the “pick up” button to see if the player character is in contact with the item to be picked up.

See also:

SCNPhysicsWorldMBS.convexSweepTest(shape as SCNPhysicsShapeMBS, fromTransform as SCNMatrix4MBS, toTransform as SCNMatrix4MBS, options as Dictionary = nil) as SCNPhysicsContactMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Searches for physics bodies in the space formed by moving a convex shape through the physics world.

shape: A physics shape. This shape must enclose a convex volume. For details on creating shapes that satisfy this requirement, see SCNPhysicsShapeMBS.
from: A transform matrix representing the initial position and orientation of the shape.
to: A transform matrix representing the final position and orientation of the shape.
options: A dictionary of options affecting the test, or nil to use default options. For applicable keys and the possible values, see Physics Test Options Keys.

Returns an array of SCNPhysicsContactMBS objects describing any contacts that would occur when moving the physics shape through the physics world.

Use this method when it’s important to plan for (or avoid) collisions ahead of the physics simulation. For example, in a game you might plan maneuvers for a flying character to fit through the gaps between static bodies in the physics world

SCNPhysicsWorldMBS.EnableContactsEvents

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Enables contact events.

If you connect the contact events via AddHandler, please call this method once to connect the events internally.

SCNPhysicsWorldMBS.rayTestWithSegment(origin as SCNVector3MBS, dest as SCNVector3MBS, options as Dictionary = nil) as SCNPhysicsBehaviorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Searches for physics bodies along a line segment between two points in the physics world.

origin: An endpoint of the line segment to search, specified in the scene’s world coordinate system.
dest: The other endpoint of the line segment to search, specified in the scene’s world coordinate system.
options: A dictionary of options affecting the test, or nil to use default options. For applicable keys and the possible values, see Physics Test Options Keys.

Returns an array of SCNHitTestResultMBS objects describing search results.

Use this method to implement concepts such as line of sight in your app. For example, in a game you might implement behavior for an enemy character by searching for physics bodies along a line between the enemy character’s position and the player character’s position

SCNPhysicsWorldMBS.removeAllBehaviors

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Removes all behaviors affecting bodies in the physics world.

SCNPhysicsWorldMBS.removeBehavior(behavior as SCNPhysicsBehaviorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Removes a behavior from the physics world.

SCNPhysicsWorldMBS.updateCollisionPairs

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Forces the physics engine to reevaluate possible collisions between physics bodies.

By default, SceneKit checks for collisions between physics bodies only once per simulation step. If you directly change the positions of any physics bodies outside of a event, call the updateCollisionPairs method before using any of the methods listed in Searching for Physics Bodies Detecting Contacts Between Physics Bodies.

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


The biggest plugin in space...