• Unity
  • Bone IK Aiming + parabolic projectile path

Related Discussions
...

I figure it out how to use bone as aim and it's working great. Problem is I got fancy projectile which follows parabolic trajectory to crosshair bone in spine. That projectile follows aim angle, but not end position. So distance it travels always constant and I need to fire it closer/further. Is it practical to try make it work or I should just code projectile spawn and parabolic trajectory?

Hey nate,
How do you reset the target once youre done with it. Example,

rightHandIk.Target = gripBone;

How would I then clear or reset the rightHandIk when done?

Note sure what you mean. To turn a constraint on/off you can set the mix to 0 (off) or 1 (on), or in between for partial. See IkConstraint mix. Usually the IK constraint is setup in Spine, so the target bone on the IK constraint is not usually assigned in code. Doing so is fine, though normally the IkConstraintData target is also set. Not doing so could be OK, as long as you don't do something that relies on it.

Sorry i meant how do i clear the target. I dont want the IK to target anything.


leftHandIk.Target = skeletonAnimation.Skeleton.FindBone("Left Hand IK");
rightHandIk.Target = skeletonAnimation.Skeleton.FindBone("Right Hand IK");

By setting the target of the leftHandIk to itself it started functioning normally with the rest of the animations. I used Debug.Log(leftHandIk.Target) to see what the default value was before i modified it and found it was "Left Hand IK"

IkConstraint.Data.Target seemed to have no influence at all. Whats the difference between IkConstraint.Data.Target and IkConstraint.Target?

DarenBarnett wrote

Sorry i meant how do i clear the target. I dont want the IK to target anything.

An IK constraint always has a target. Set the mix to zero if you don't want the constraint applied. I doubt you need to ever assign the target.

DarenBarnett wrote

IkConstraint.Data.Target seemed to have no influence at all. Whats the difference between IkConstraint.Data.Target and IkConstraint.Target?

*Data classes hold data for the setup pose. See the class diagram here:
Runtime Architecture - Spine Runtimes Guide: Class diagram