IKControl

Show Deprecated

IKControl instances generate procedural animation poses using Inverse Kinematics (IK). They allow you to make characters respond realistically to their environment.

For example, you can make a character place its hand on a door handle exactly, and the character will do so independently of its position. IKControls provide the advantage of needing to create much fewer animations for your game while giving your experience a more realistic and polished feel.

IKControls must be a child of a Humanoid or AnimationController with an Animator and have all of their required properties set properly, otherwise they don't have any effect. The required properties are Type, EndEffector, Target, ChainRoot. As soon as those are set, the IkControl modifies the pose of your character as you specify. The following code sample demonstrates how to set up your first IKControl and get started with creating more realistic animations for your game.

You can use IKControls to make a character:

  • Rotate its head and torso to look at a point of interest in the world.
  • Modify its feet positions to respond to dynamic terrain. Adjust its legs and feet to place them accordingly on terrain with rocks and slopes.
  • Hold a gun and place its hands appropriately on the grip without needing to create animations for each gun in the game.
  • Aim at a point in the world, so that the tip of the gun point exactly at what you want to shoot. Especially useful in third person shooters.
  • Place its hands on the steering wheel of a car and follow it when it rotates.
  • Much more!

IKControl will override the animation for all the parts between the ChainRoot and the EndEffector. You can enable/disable it using Enabled or change how much they have an effect over the underlying animation using the Weight. Be careful: if you do not set up your IKControls correctly, you might generate bad and unrealistic poses!

Code Samples

This sample shows the basic setup for an IKControl that moves a character's left arm to reach for a point in the world.

IKControl setup

local character = script.Parent.Character
local humanoid = character.Humanoid
local root = character.HumanoidRootPart
-- Create a new attachment to use as the IKControl.Target
local target = Instance.new("Attachment")
target.CFrame = CFrame.new(-1, 0, -1)
target.Parent = root
local ikControl = Instance.new("IKControl")
ikControl.Type = Enum.IKControlType.Position
ikControl.EndEffector = character.LeftHand
ikControl.ChainRoot = character.LeftUpperArm
ikControl.Target = target
ikControl.Parent = humanoid

Summary

Properties

Properties

ChainRoot

Read Parallel

Enabled

Read Parallel

EndEffector

Read Parallel

EndEffectorOffset

Read Parallel

Offset

Read Parallel
Read Parallel

Priority

Read Parallel

SmoothTime

Read Parallel

Target

Read Parallel
Read Parallel

Weight

Read Parallel

Methods

GetChainCount


Returns

GetChainLength


Returns

GetNodeLocalCFrame

Parameters

index: number

Returns

GetNodeWorldCFrame

Parameters

index: number

Returns

GetRawFinalTarget


Returns

GetSmoothedFinalTarget


Returns

Events