collisionOptions
TypeScriptget collisionOptions(): CollisionComponent_CollisionOptionsSwift declarationvar collisionOptions: CollisionComponent.CollisionOptions { get set }struct · iOS 13.0+ · SDK 27.1
struct CollisionComponentA component that gives an entity the ability to collide with other entities that also have collision components. This component holds the entity's data related to participating in the scene's physics simulation. It is also used to calculate collision queries, raycasts, and convex shape casts. Entities can participate in the scene simulation in two different modes: as a *rigid body* or as a *trigger*. A rigid body fully participates in the collision simulation. It affects the velocity and direction of entities it collides. If configured with a rigid body ``RealityKit/PhysicsBodyComponent/mode`` of ``RealityKit/PhysicsBodyMode/dynamic``, it's own velocity and direction can be affected by other rigid body entities. A trigger entity doesn't have any impact on the rigid bodies in the scene, but can trigger code or Reality Composer behaviors when a rigid body entity overlaps it. Note the following when considering applying a non-uniform scale to an entity: - Non-uniform scaling is applicable only to box, convex mesh and triangle mesh collision shapes. - Non-uniform scaling is not supported for all other types of collision shapes. In this case the scale.x value is duplicated to the scale's y and z components as well to force scale uniformity based on the x component. - If the entity has a non-uniform scale assigned to its transform then that entity should not have any descendants assigned that contain rotations in their transforms. A good rule of thumb is to assign the non-uniform scale to the entity that has the collision shape, and avoid adding children below that entity. Turn an entity into a trigger by adding a ``RealityKit/CollisionComponent`` to it and setting its ``RealityKit/CollisionComponent/mode-swift.property`` to ``RealityKit/CollisionComponent/Mode-swift.enum/trigger``. Turn an entity into a _rigid body_ by adding a ``RealityKit/PhysicsBodyComponent`` to the entity in addition to a ``RealityKit/CollisionComponent``. The ``PhysicsBodyComponent`` defines the physical properties of the entity, such as its mass and collision shape. The `filter` property defines the entity's collision filter, which determines which other objects the entity collides with. For more information, see <doc://com.apple.documentation/documentation/realitykit/controlling_entity_collisions_in_realitykit>. - Note: If an entity has a ``RealityKit/PhysicsBodyComponent``, the collision component's mode is ignored. An entity can be a rigid body, or a trigger, but not both at the same time.
get collisionOptions(): CollisionComponent_CollisionOptionsSwift declarationvar collisionOptions: CollisionComponent.CollisionOptions { get set }set collisionOptions(value: CollisionComponent_CollisionOptions)Swift declarationvar collisionOptions: CollisionComponent.CollisionOptions { get set }get mode(): CollisionComponent_ModeSwift declarationvar mode: CollisionComponent.ModeThe collision mode.
set mode(value: CollisionComponent_Mode)Swift declarationvar mode: CollisionComponent.ModeThe collision mode.
get filter(): CollisionFilterSwift declarationvar filter: CollisionFilterThe collision filter used to segregate entities into different collision groups.
set filter(value: CollisionFilter)Swift declarationvar filter: CollisionFilterThe collision filter used to segregate entities into different collision groups.
static initShapesModeCollisionOptionsFilter(shapes: Array<ShapeResource>, mode: CollisionComponent_Mode, collisionOptions: CollisionComponent_CollisionOptions, filter?: CollisionFilter): CollisionComponentSwift declarationinit(shapes: [ShapeResource], mode: CollisionComponent.Mode = .default, collisionOptions: CollisionComponent.CollisionOptions, filter: CollisionFilter = .default)static initShapesModeFilter(shapes: Array<ShapeResource>, mode?: CollisionComponent_Mode, filter?: CollisionFilter): CollisionComponentSwift declarationinit(shapes: [ShapeResource], mode: CollisionComponent.Mode = .default, filter: CollisionFilter = .default)Creates a collision component with the given collision shape, mode, and filter parameters. - Parameters: - shapes: The collection of shapes that collectively define the outer dimensions of the associated entity for the purposes of collision detection. - mode: The mode of the collision component. - filter: A filter that limits the other entities with which the entity can collide.
static initShapesIsStaticFilter(shapes: Array<ShapeResource>, isStatic: boolean, filter?: CollisionFilter): CollisionComponentSwift declarationinit(shapes: [ShapeResource], isStatic: Bool, filter: CollisionFilter = .default)Creates a collision component.
get shapes(): Array<ShapeResource>Swift declarationvar shapes: [ShapeResource]A collection of shape resources that collectively represent the outer dimensions of an entity for the purposes of collision detection.
set shapes(value: Array<ShapeResource>)Swift declarationvar shapes: [ShapeResource]A collection of shape resources that collectively represent the outer dimensions of an entity for the purposes of collision detection.
get isStatic(): booleanSwift declarationvar isStatic: Bool { get set }A Boolean value that indicates whether the collider is static. When an object is static the physics engine recognizes that the object isn't moving, which typically improves performance.
set isStatic(value: boolean)Swift declarationvar isStatic: Bool { get set }A Boolean value that indicates whether the collider is static. When an object is static the physics engine recognizes that the object isn't moving, which typically improves performance.
No declarations were skipped in this snapshot.