When I set the mode of a CollisionComponent in RealityKit to .trigger it still collides with other objects. To my knowledge triggers should pass through other colliders. This is how I set up the triggers:
func addCube() {
let entity = ModelEntity(mesh: .generateBox(size: 0.1,
cornerRadius: 0.0),
materials: [SimpleMaterial(color: .red,
isMetallic: false)])
entity.collision = CollisionComponent(shapes: [ShapeResource.generateBox(width: 0.1,
height: 0.1,
depth: 0.1)],
mode: .trigger)
entity.physicsBody = PhysicsBodyComponent()
entity.setPosition([0.0, 0.2, 0.0], relativeTo: nil)
root.addChild(entity)
}
I can only set the CollisionComponent’s filter correctly to ignore the same kind of entity, then they pass through each other, but then the subscription events of the colliders to not trigger anymore. Did someone manage to use triggers correctly in RealityKit?




