After playing with this for a bit more, something that would be useful is an offset for the EndEffector.
Consider this case, where I want the arm to be pointing toward an attachment but not necessarily stretching to it:
desired behavior
current behavior
Current options are to rotate the c0/c1 of the wrist joint or place the target in a different place, both of which are not ideal.
This would also help with making sure the correct part of the EndEffector is moving to the target, so the wrist/ankle/etc joint is not always stretching to the desired point but rather the center/offset.
Another example, aligning the bottom of the feet rather than the ankle:
This is awesome, but why does my character look at the complete opposite direction of the targeted object when LookAt is enabled? (the targeted object is the door) https://gyazo.com/c3e5431d1373e334859e500dcbffc84f
Great suggestion, thanks! We are working on some of the points you mentioned:
A property to affect how much the IK overrides animations
The Weight property should allow you to do that
An enumeration to affect where the center of the target is (The center or the pivot).
This feature will be released soon, we’ve just finished development on it
Setting the weight should update the positions of the part correctly and also make them gradually interpolate to the new weight. If I set the weight from 1 to 0.5, the next time I move it will be jittery to the new weight meaning to get a good effect I would have to manually lerp it myself.
We don’t have any smoothing factor applied on top because not all developers might want that feature, and can code a lerp like you said on top of the Weight property. But if this becomes something many people ask, we might add something like it.
If I set weight to 0 it just keeps my hand in the same last position unlike how AnimationTracks act where it just stops affecting its position.
If you have an animation playing, that will be the behavior. If not, the IKControl will not have any effect but the previous position will be preserved. We might look into providing an option to reset the pose in the future.
Hi, this is a great suggestion and I completely agree. We’ve got an API update prepared that will introduce what you mention, probably under the name of “AlignmentOffset”. It should solve the use-case you mention and others like moving the arms to point the tip of a rifle to a point (and not point the hands themselves). It will probably be released in the next 1-2 weeks.
At the moment the behavior you mention can be achieved by recomputing Target or using the Offset property to compute an offset in the EndEffector space but that’s not ideal.
I am not the sharpest tool in the shed, but how do I take a pre-existing animation like a walk and apply this IK stuff to it? Only way I can think of doing this is by creating the entire animation by updating IKControl.Target, but there has to be a better way, an automated one perhaps?
Likely you’ll need to annotate your animation with events so you know when the foot is supposed to be planted. Not sure how you’d do this with non-custom walk animations though, you might be able to make an educated guess by measuring distance between the foot and the floor to detect plantedness. When the foot is planted, you should raycast (some distance above the foot, downwards to mitigate clipping) to determine the positioning for the foot on the floor, then move the target there, each frame for the duration of the planted portion of the animation. You can use the transform mode to match the orientation of the foot to the normal of the floor.
Haven’t tried this myself yet so this is just a rough idea. Note also that there might be timing issues with raycasting for the foot position from the raw animation position before the IK is applied, so you probably need to use a specific event to do this properly. I think RunService has several events, but I’m not sure when the IK calculations happen so you might have to experiment.
I’m trying to get this to work with my custom characters and I’m not seeing the instance have any effect (or any effect that doesn’t teleport body parts somewhere else) on some of my characters. These are old characters that were built manually rather than imported that I really do not want to try to redo through the importer.
What are the particular character requirements? I.e. the required naming of attachments, motor hierarchy direction (e.g. the head contains the motor connecting it to the torso, or vice versa), required children of instances (e.g. originalposition, originalsize), or god forbid part names? These kinds of details are annoyingly never documented.
Aside, definitely need a way to offset the EndEffector in local space. This is a lot more intuitive than offsetting the target.
How did you achieve this effect? I’m raycasting from the player’s feet as well but I’m getting really odd results, and it completely overrides the walk animations.
You can achieve the behavior you mention about anchoring joints by using the ChainRoot property. That specifies the upper-most joint that can be affected, so if you don’t want the UpperArm to move, you can set as ChainRoot the LowerArm and only that + the Hand will.
The reply by @PeZsmistic is spot-on.
You can create custom animation by animating the Target and/of Offset property as you wish.
For the foot-planting, the suggested solution is exactly how we also do it, using raycasts to detect the ground point and normal. We’ll release a script for foot-planting soon.
The IK solver runs after the animation step one but before physics. It happens right after the RunService “Stepped” event, so you can use that to do your computation.
For characters using Motor6D, we currently require a setup similar to how R15 are:
a MeshPart (e.g. Hand) that has a Motor6D under it (e.g. Wrist) should have that Motor Part0 be the parent part (e.g. LowerArm) and Part1 be the part itself (e.g. Hand).
That’s the way we currently walk the hierarchy but we’re working to make it so that any setup works. I’ll make sure to document as you suggested.
we don’t have any other requirements, but if the part are named like an R15, we detect when you are working on an arm or leg and automatically make it bend as you would expect without the need to set a Pole manually.