如何使用偏移量将部件移动到玩家的躯干?

我已经尝试从Vector3切换到CFrame,但仍然无法正常工作。我最好的结果是部分显示在空中的10英尺高度,这是我目前的结果。

 local Dog = game:GetService("ReplicatedStorage"):WaitForChild("PetTesting")

local RunService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")

local Petfollow = game:GetService("ReplicatedStorage"):WaitForChild("PetFollow")

game.Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(char)
    wait(1)
    local dc = Dog:Clone()
    dc.Name = "Pet"
    dc.Parent = char
    local offsetCframe = CFrame.new(0, 0, 0)
    dc.CFrame = char:WaitForChild("HumanoidRootPart").CFrame + offsetCframe
    dc.Anchored = true
    dc.CanCollide = false
    dc.Transparency = 0
end)
end)
点赞
用户9808476
用户9808476

你可以使用一些 CFrame 操作,如 https://developer.roblox.com/en-us/api-reference/datatype/CFrame 中所述。我不确定这是否是正确的做法,如果不正确,请回复。

local offset = Vector3.new(0, 0, 10)
local newCFrame = humanoidRootPart.CFrame * offset
2020-01-04 18:02:16