Posts

Post not yet marked as solved
3 Replies
587 Views
Hi, I have a usdz asset of a torus / hoop shape that I would like to pass another Reality Kit Entity cube-like object through (without touching the torus) in VisionOS. Similar to how a basketball goes through a hoop. Whenever I pass the cube through, I am getting a collision notification, even if the objects are not actually colliding. I want to be able to detect when the objects are actually colliding, vs when the cube passes cleanly through the opening in the torus. I am using entity.generateCollisionShapes(recursive: true) to generate the collision shapes. I believe the issue is in the fact that the collision shape of the torus is a rectangular box, and not the actual shape of the torus. I know that the collision shape is a rectangular box because I can see this in the vision os simulator by enabling "Collision Shapes" Does anyone know how to programmatically create a torus in collision shape in SwiftUI / RealityKit for VisionOS. Followup, can I create a torus in reality kit, so I don't even have to use a .usdz asset?
Posted Last updated
.
Post not yet marked as solved
2 Replies
708 Views
I have an immersive space ImmersiveSpace(id: "FlappyImmersiveSpace") { FlappySpace() } On this immersive space, I want to add a gesture recognizer, so that no matter where you are looking in the immersive space, I can detect a pinch. ImmersiveSpace(id: "FlappyImmersiveSpace") { FlappySpace() .gesture( TapGesture() .onEnded({ _ in print("TAPPED") }) ) } This doesn't work. struct FlappySpace: View { var body: some View { RealityView { content in // Add content } .gesture( TapGesture() .onEnded({ _ in print("TAPPED") }) ) } } Neither does this. Does any one know how to detect gestures in an immersive space, the gesture can not be specific to an entity in the space, but any where in the entire space.
Posted Last updated
.