Hello, I have been working on a pet following system but I have been struggling with calculating the Y offset so that the pet “Walks” on the ground.
My code:
local position = (character.HumanoidRootPart.CFrame * CFrame.new(x,1,z))
pet:SetPrimaryPartCFrame(pet.PrimaryPart.CFrame:Lerp(position,0.1))
local _, characterSize = character:GetBoundingBox()
local _, petSize = pet:GetBoundingBox()
local offsetY = - characterSize.Y/2 + petSize.Y/2
pet:SetPrimaryPartCFrame(character.PrimaryPart.CFrame * CFrame.new(offsetX, offsetY, offsetZ))
I don’t think pets in games even “walk” anyways, but if you want them to actually walk you can have your pet be a “humanoid” and have it walk on the ground with physics