I have a question about creating skinned mesh custom characters specific bones face a player or a target. I’m looking for something similar to how R6/R15 rigs heads orient toward the player’s camera, but applied to individual bones.
I’ve already highlighted the bones in Blender that need to move. How would you recommend approaching this?
That’s pretty easy
Bones are basically attachments.
You can edit the WorldCFrame of the bone to face the player.
Just make sure you selected the right bone.
Alright, This is what I’ve managed to do, This works flawlessly even on the server side, But I’d rather handle it on the client. Anyways, Here’s the code
The offset is just the Orientation of the bone, but inverted, You could play around with the offset and get a much more accurate facing.
local rs = game:GetService("RunService")
local npc = script.Parent
local target = game.Workspace.Part
local Bones = {
Neck1 = {
Bone = npc:FindFirstChild("Neck1", true);
Offset = CFrame.Angles(-math.rad(39.548),0,0);
};
}
rs.Heartbeat:Connect(function()
for _, data in pairs(Bones) do
local bone = data.Bone
if bone then
local look = CFrame.lookAt(
bone.WorldPosition,
target.Position
)
bone.WorldCFrame = bone.WorldCFrame:Lerp(look * data.Offset, 0.15)
end
end
end)