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
757
Oct ’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
638
Oct ’22