I am attempting to make my system of pets be able to wrap around the player automtically no matter what but for some reason when I play the game my pet is position underground around the player instead of next to him. I got this method from @OverHash on this post Having multiple 'pets' at once?
NOTE:
I use a custom character mesh
here is my update code
local petSpring = Spring.new(Vector3.new())
petSpring.Damper = 1
petSpring.Speed = 100
local function UpdatePetPosition()
local newPosition = (self.Character.HumanoidRootPart.CFrame * CFrame.new(MathUtil.GetPointOnCircle(25, 360/1))).p - Vector3.new(0, self.Character.HumanoidRootPart.Size / 2, 0) + Vector3.new(0, PetMesh.Size.Y, 0)
petSpring.Target = newPosition
PetMesh.CFrame = CFrame.new(petSpring.Position)
end
self.Maid:GiveTask(RunService.Stepped:Connect(UpdatePetPosition))
self.Maid:GiveTask(PetMesh)
here is my GetPointOnCircle Function
function MathUtil.GetPointOnCircle(CircleRadius, Degrees)
return Vector3.new(math.cos(math.rad(Degrees)) * CircleRadius, 0, math.sin(math.rad(Degrees)) * CircleRadius)
end