-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
I’ve got two entities:
AnchorEntityA
- ModelEntityA
AnchorEntityB
-ModelEntityB
These AnchorEntities each have an arbitrary position and orientation, and the ModelEntity children have an independent scale value. Each ModelEntity has a simple cube model. My goal is to subtract mesh B from mesh A. I want the Meshes oriented and scaled relative to each other just as their parent entities are in my scene.
Here's how I create the Mesh objects:
var modelEntityA = entityA.findChild(name: "scaledCubeCollisionZone", type: ModelEntity.self)!
var modelEntityB = entityB.findChild(name: "scaledCubeCollisionZone", type: ModelEntity.self)!
var meshA = Mesh.init(modelEntityA)
var meshB = Mesh.init(modelEntityB)
let newMesh = meshA.subtracting(meshB)
It looks like each Mesh object gets a Transform from its ModelEntity, but this Transform only transforms the child relative to its parent. I want the Mesh to include the parent entity's Transform in addition to the ModelEntity Transform. I've tried composing these entity transforms:
modelEntityA.transform = Transform(matrix: entityA.transform.matrix * modelEntityA.transform.matrix)
modelEntityB.transform = Transform(matrix: entityB.transform.matrix * modelEntityB.transform.matrix)
But it just fails this assertion:
extension Plane {
init(unchecked normal: Vector, w: Double) {
assert(normal.isNormalized)
How should I be doing this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels