Occluded floor */ let floor = ModelEntity(mesh: .generatePlane(width: 100, depth: 100), materials: [OcclusionMaterial()]) floor.generateCollisionShapes(recursive: false) floor.components[PhysicsBodyComponent.self] = .init( massProperties: .default, mode: .static ) content.add(floor) /* steel ball */ let ball = ModelEntity( mesh: .generateSphere(radius: 0.1), materials: [SimpleMaterial(color: .white, isMetallic: true)]) ball.generateCollisionShapes(recursive: false) // Enable interactions on the entity. ball.components.set(InputTargetComponent()) ball.components.set(CollisionComponent(shapes: [.generateSphere(radius: 0.1)])) // gravity to PhysicsBody ball.components[PhysicsBodyComponent.self] = .init( PhysicsBodyComponent( // mass in kilograms massProperties: .init(mass: 5.0), material: .generate( staticFriction: 0.0, dynamicFriction: 0.0, restitution: 0.5 ), mode: .dynamic ) )