I am trying to rotate topEntity around the origin point of shapeEntity, but have not found a way to do so.
topEntity is an entity group that also contains shapeEntity, so I cannot set topEntity as a child of shapeEntity.
From Blender I set the correct origin of topEntity, but when I import the usd model into Reality Composer Pro it does not save the origin point and there is no way to set the origin in Reality Composer Pro.
DragGesture()
.targetedToEntity(where: .has(CustomComponent.self))
.onChanged({ value in
let rotation = -Float(value.translation.height)
let clampedRotation = min(max(rotation, 0), 45)
if value.entity.name == "grab"{
if let topEntity = selectedEntity.findEntity(named: "top"),
let shapeEntity = selectedEntity.findEntity(named: "Shape_1"){
topEntity.transform.rotation = simd_quatf(
angle: clampedRotation * .pi / 180,
axis: SIMD3(x: 0, y: 0, z: 1)
)
}
}
})