Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a bone follow a part while being parented to another part?

Asked by 3 years ago
Edited 3 years ago

So I'm trying to make a "morph" type of thing using the new skinned meshparts update. I am trying to make a bone copy the same movements as another part. By the way, I don't want to make an animation as this is meant to work with all roblox animation packs.

Here is some code:

local RP = char.Luigi.RootPart
local rBone = RP.root.root_motion

local opHead = nil

while true do
    Swait()
    --head
    local bone = rBone.root_body.ske_body.root_head
    local compare = char["UpperTorso"]
    if opHead == nil then
        opHead = bone.Position
    end
    local rotate = Vector3.new(-(hed.Orientation.x - root.Orientation.x), hed.Orientation.y - root.Orientation.y, hed.Orientation.z - root.Orientation.z) - Vector3.new(compare.Orientation.x - root.Orientation.x, compare.Orientation.y - root.Orientation.y, compare.Orientation.z - root.Orientation.z)
    local pos = Vector3.new(-(hed.Position.x - root.Position.x), hed.Position.y - root.Position.y, hed.Position.z - root.Position.z) - Vector3.new(compare.Position.x - root.Position.x, compare.Position.y - root.Position.y, compare.Position.z - root.Position.z)
    bone.Orientation = rotate
    bone.Position = opHead + pos
end
0
Update: I have kind of fixed it but its still super broken. By the way, the point of the morph is to be able to play any roblox animation for R15, not just custom ones youngmacka123 17 — 3y

Answer this question