happy new year! :) and exciting news today about the feb 2nd launch!!
i just wanted to come back to this as i am stumped.. i'm sure i'm doing something really dumb...
this is my test gesture handler.. anchor is an AnchorEntity with a plane target. the grey sphere is a child of the anchor at the anchor's origin, and has a CollisionComponent and an InputTargetComponent.
.gesture(SpatialTapGesture().targetedToAnyEntity()
.onChanged({ value in
})
.onEnded({ value in
let material = SimpleMaterial(color: .systemPink, roughness: 0.1, isMetallic: true)
let location3D = value.convert(value.location3D, from: .local, to: anchor) // i've tried .scene.. specifying the anchor seems to be slightly closer results. i've also tried .global instead of .local for the from
let tap = createSphereEntity(0.01, material: material, interactable: false)
anchor.addChild(tap, preservingWorldTransform: false)
tap.setPosition(location3D, relativeTo: nil)
})
)
i've attached an image of the result i get. as you can see, the "tap" entities that are created are offset from the anchor. i've tried so many combinations of coordinate spaces, preserving world transforms, changing the order of things etc...
if the object is not anchored
the following code works great for non anchored entities:
.gesture(SpatialTapGesture().targetedToAnyEntity()
.onChanged({ value in
})
.onEnded({ value in
let material = SimpleMaterial(color: .systemPink, roughness: 0.1, isMetallic: true)
let location3D = value.convert(value.location3D, from: .local, to: .scene)
let tap = createSphereEntity(0.01, material: material, interactable: false)
value.entity.addChild(tap, preservingWorldTransform: false)
tap.setPosition(location3D, relativeTo: nil)
})
see the screenshot with the yellow shows the expect results
any ideas what i'm doing wrong? :)