TobyWils

My character reaches out to touch various props in the world and I'd like to use IK so the spot on the prop can variable by a few pixels and they always touch the correct spot. Is that possible? I've seen demos where some point a gun at a spot and haven't had any luck tracking down the code.
TobyWils
  • 記事: 22

Nate

You can position a bone (the IK target) where you want them to touch. What runtime are you using?
アバター
Nate

Nate
  • 記事: 11544

TobyWils

I'm using the c++ runtime. Position the bone at a world coord?
TobyWils
  • 記事: 22

Nate

You can use Bone::worldToLocal to set the local Bone x and Bone y. Remember in world coordinates 0,0 is the position of the skeleton (Skeleton x and Skeleton y). You'll need to Skeleton updateWorldTransform after changing the bone's local transform. Also note applying an animation may change your bone position, if it is keyed. In that case you can modify the bone's local position every frame, after applying animations.
アバター
Nate

Nate
  • 記事: 11544


Return to Runtimes