Platforms to show: All Mac Windows Linux Cross-Platform

Back to SCNPhysicsShapeMBS class.

SCNPhysicsShapeMBS.Constructor(geometry as SCNGeometryMBS, Options as Dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a physics shape based on a geometry object.

geometry: A geometry object.
options: A dictionary of options affecting the level of detail of the physics shape, or nil to use default options. For applicable keys and their possible values, see Shape Creation Options Keys.

Returns a new physics shape object.

If you create a physics shape using one of the basic geometry classes (SCNBoxMBS, SCNSphereMBS, SCNPyramidMBS, SCNConeMBS, SCNCylinderMBS, or SCNCapsuleMBS), SceneKit uses an idealized form of that geometry for the physics shape instead of using the geometry’s vertex data to simulate collisions. For example, if you create a physics shape from an SCNSphere object, SceneKit simulates collisions for any object that passes within the sphere’s radius.

Because the idealized forms of simple geometries are computationally much simpler than the vertex data needed for displaying them, using basic geometries for physics shapes (or compound shapes created from basic geometries with the shapeWithShapes method) often provides the best balance between simulation accuracy and performance.

To use the newly created physics shape, create a physics body with the the bodyWithType method, or assign the shape to the physicsShape property of an existing body.

See also:

SCNPhysicsShapeMBS.Constructor(node as SCNNodeMBS, Options as Dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a physics shape from a node or hierarchy of nodes.

node: A node object. The node must contain an SCNGeometryMBS object in its geometry property or have one or more child (or descendant) nodes that contain geometry.
options: A dictionary of options affecting the level of detail of the physics shape, or nil to use default options. For applicable keys and their possible values, see Shape Creation Options Keys.

Returns a new physics shape object.

To use the newly created physics shape, create a physics body with the the bodyWithType method, or assign the shape to the physicsShape property of an existing body.

The node used to create the physics shape need not be the same as the node whose physics body you attach the shape to—or even be in the scene whose physics world you use the shape in. For example, you can create a physics body for a complex object by building a hierarchy of nodes containing simple geometries (using the SCNBoxMBS and SCNSphereMBS classes), and then creating a physics shape from those nodes. The resulting physics shape, a compound of bounding boxes or convex hulls, provides a rough approximation of the complex object without a high cost to simulation performance.

See also:

SCNPhysicsShapeMBS.copy as SCNPhysicsShapeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Creates a copy of the shape.

SCNPhysicsShapeMBS.sourceObject as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The object that was used to create the shape.

This property, along with the transforms and options properties, provides the information that was used to create the shape. You can use this information, for example, to draw editing or debugging UI in your scene.

  • If the shape was created with the shapeWithGeometry method, the source object is an SCNGeometryMBS object, and the options property contains the options affecting the shape’s construction from that geometry.
  • If the shape was created with the shapeWithNode method, the source object is an SCNNodeMBS object, and the options property contains the options affecting the shape’s construction from that node.
  • If the shape was created with the shapeWithShapes method, the source object is an array of SCNPhysicsShapeMBS objects and the transforms property describes how those shapes combine to form a compound shape.

SCNPhysicsShapeMBS.transforms as SCNMatrix4MBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method SceneKit MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The array of transforms that was used to create a compound shape.

You provide this array of SCNMatrix4MBS values, in the shapeWithShapes method to create a compound shape. Use this array along with the sourceObject property to recover the information that was used to create the shape.

If the shape was created with the shapeWithGeometry or shapeWithNode method, this property’s value is nil.

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


The biggest plugin in space...