Post

Replies

Boosts

Views

Activity

How to create accurate CollisionShapes for my 3D .USDZ model?
This is how my model looks like and it's collision shapes (pink color). My problem with this is that when I try to tap on the bottommost part of my model (the circle), I can't do that, because the uppermost part of the model's CollisionShape is in the way. This is how i tried to create an accurate collisionShape for my model: @objc private func placeObject() {           let entity = try! Entity.load(named: "Laryngeal")     let geom = entity.findEntity(named: "Geom")           for children in geom!.children {       let childModelEntity = children as! ModelEntity       childModelEntity.collision = CollisionComponent(shapes: [ShapeResource.generateConvex(from: childModelEntity.model!.mesh)])     }           let modelEntity = ModelEntity()     modelEntity.addChild(entity)           let anchorEntity = AnchorEntity(plane: .horizontal)     anchorEntity.addChild(modelEntity)     arView.installGestures([.all],for: modelEntity)     arView.scene.addAnchor(anchorEntity)         } So my question is, how can i create the most accurate collisionShape which perfectly fits my model?
2
1
1.1k
Nov ’22
Is is possible to intallGestures on Entity object?
This is my code now:           let entity = try! Entity.load(named: "Hand") //This returns a Entity     //let entity = try! Entity.loadModel(named: "Hand") //This returns a ModelEntity     entity.generateCollisionShapes(recursive: true)           // Anchoring the entity and adding it to the scene     let anchor = AnchorEntity(plane: .horizontal)     anchor.addChild(entity)     self.arView.scene.addAnchor(anchor)                  // installing gestures for the Entity     self.arView.installGestures(for: entity) //This only works on ModelEntity apparently   } Is it possible to somehow installGestures on the Entity object and not only the ModelEntity? Because if I try to installGestures on Entity I get an error: "Entity does not conform to type HasCollision"
0
0
746
Oct ’22
How to create accurate CollisionShapes for my 3D .USDZ model?
This is how my model looks like and it's collision shapes (pink color). My problem with this is that when I try to tap on the bottommost part of my model (the circle), I can't do that, because the uppermost part of the model's CollisionShape is in the way. This is how i tried to create an accurate collisionShape for my model: @objc private func placeObject() {           let entity = try! Entity.load(named: "Laryngeal")     let geom = entity.findEntity(named: "Geom")           for children in geom!.children {       let childModelEntity = children as! ModelEntity       childModelEntity.collision = CollisionComponent(shapes: [ShapeResource.generateConvex(from: childModelEntity.model!.mesh)])     }           let modelEntity = ModelEntity()     modelEntity.addChild(entity)           let anchorEntity = AnchorEntity(plane: .horizontal)     anchorEntity.addChild(modelEntity)     arView.installGestures([.all],for: modelEntity)     arView.scene.addAnchor(anchorEntity)         } So my question is, how can i create the most accurate collisionShape which perfectly fits my model?
Replies
2
Boosts
1
Views
1.1k
Activity
Nov ’22
Is is possible to intallGestures on Entity object?
This is my code now:           let entity = try! Entity.load(named: "Hand") //This returns a Entity     //let entity = try! Entity.loadModel(named: "Hand") //This returns a ModelEntity     entity.generateCollisionShapes(recursive: true)           // Anchoring the entity and adding it to the scene     let anchor = AnchorEntity(plane: .horizontal)     anchor.addChild(entity)     self.arView.scene.addAnchor(anchor)                  // installing gestures for the Entity     self.arView.installGestures(for: entity) //This only works on ModelEntity apparently   } Is it possible to somehow installGestures on the Entity object and not only the ModelEntity? Because if I try to installGestures on Entity I get an error: "Entity does not conform to type HasCollision"
Replies
0
Boosts
0
Views
746
Activity
Oct ’22
Find a tapped childNode in 3D object in RealityKit
How can I access the exact child node's name that the user tapped on? So for example, if the user taps on the Humerus_l node I could print it's name to the console. This is how my 3D USDZ model and its Scene graph looks like. I can also convert it into a .rcproject file but I couldn't make it work with that either.
Replies
3
Boosts
0
Views
1.6k
Activity
Sep ’22