@Vision Pro Engineer Fantastic, thank you for the detailed response. This approach makes sense, but I am still wondering about setting the hand position at every frame. Could you please share an implementation for this using the Entity Component System as you mentioned? I'd like to use a DragGesture() targeted to the 'handJoint' to direct its position at each frame, which I have been able to implement without IK. I'm thinking along these lines, but I do not know what I am missing (note this example code does not successfully update the handJoint and other joint positions):
.gesture(
DragGesture()
.targetedToEntity(shapes.handJoint)
.onChanged { value in
let currentHandPosition = value.convert(value.location3D, from: .local, to: shapes.skeletonContainerEntity)
var ikComponent = shapes.skeletonContainerEntity.components[IKComponent.self]!
ikComponent.solvers[0].constraints["end_constraint"]!.target.translation = currentHandPosition
shapes.skeletonContainerEntity.components.set(ikComponent)
}
)
Thank you very much!
Topic:
Spatial Computing
SubTopic:
General
Tags: