Platforms to show: All Mac Windows Linux Cross-Platform
SCNPhysicsShapeMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | SceneKit | MBS Mac64bit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
When SceneKit performs contact detection and other simulations for the SCNPhysicsBodyMBS objects in your scene, it uses physics shapes instead of the rendered geometry of visible objects. This approach both improves simulation performance and allows you to more easily design your gameplay around scene elements the player can interact with.
Simple Versus Complex Shapes
When you allow SceneKit to automatically create a physics shape, it uses the simplest possible shape roughly matching the geometry of the node the physics body is attached to. This approach maximizes simulation performance but can lead to unrealistic physics behavior for some objects.
You can make the simulation behave more realistically by defining physics shapes that more closely follow the visible geometry in your scene. This approach comes at a cost to performance, so you want to limit the amount of detail in your physics shapes. Use the highest levels of detail only on bodies for which precise collision detection is important for your app.
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.
Changing a Physics Body’s Shape
Physics shapes are immutable, but you can change the shape associated with a physics body by creating a new SCNPhysicsShape instance and assigning it to the body’s physicsShape property.
- 2 properties
- 5 methods
- method Constructor(geometry as SCNGeometryMBS, Options as Dictionary = nil)
- method Constructor(node as SCNNodeMBS, Options as Dictionary = nil)
- method copy as SCNPhysicsShapeMBS
- method sourceObject as Variant
- method transforms as SCNMatrix4MBS()
- 10 shared methods
- shared method SCNPhysicsShapeKeepAsCompoundKey as String
- shared method SCNPhysicsShapeOptionCollisionMargin as String
- shared method SCNPhysicsShapeScaleKey as String
- shared method SCNPhysicsShapeTypeBoundingBox as String
- shared method SCNPhysicsShapeTypeConcavePolyhedron as String
- shared method SCNPhysicsShapeTypeConvexHull as String
- shared method SCNPhysicsShapeTypeKey as String
- shared method shapeWithGeometry(geometry as SCNGeometryMBS, Options as Dictionary = nil) as SCNPhysicsShapeMBS
- shared method shapeWithNode(node as SCNNodeMBS, Options as Dictionary = nil) as SCNPhysicsShapeMBS
- shared method shapeWithShapes(shapes() as SCNPhysicsShapeMBS, transforms() as SCNMatrix4MBS = nil) as SCNPhysicsShapeMBS
This class has no sub classes.
Blog Entries
Some methods using this class:
- SCNPhysicsBodyMBS.body(type as Integer, shape as SCNPhysicsShapeMBS) as SCNPhysicsBodyMBS
- SCNPhysicsBodyMBS.Constructor(type as Integer, shape as SCNPhysicsShapeMBS)
- SCNPhysicsWorldMBS.convexSweepTest(shape as SCNPhysicsShapeMBS, fromTransform as SCNMatrix4MBS, toTransform as SCNMatrix4MBS, options as Dictionary = nil) as SCNPhysicsContactMBS()
Some properties using for this class:
- SCNPhysicsBodyMBS.physicsShape as SCNPhysicsShapeMBS
Some examples using this class:
Some related classes:
- class SCNBoxMBS
- class SCNCapsuleMBS
- class SCNConeMBS
- class SCNCylinderMBS
- class SCNGeometryMBS
- class SCNMatrix4MBS
- class SCNNodeMBS
- class SCNPhysicsContactMBS
- class SCNPhysicsWorldMBS
- class SCNSphereMBS
The items on this page are in the following plugins: MBS Mac64bit Plugin.
SCNPhysicsHingeJointMBS - SCNPhysicsSliderJointMBS
