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
An abstraction of a physics body’s solid volume for tuning collision detection.

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.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

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

SCNPhysicsHingeJointMBS   -   SCNPhysicsSliderJointMBS

The biggest plugin in space...