My problem is that my pet doesn’t forward in the direction of its owner
I’ve searched and experimented for a few hours, using CFrame to make it LookAt wherever the player looks at “works” but it causes my pet to glitch and stutter because of the loop in my code
Align Orientation was working fine, but when I switched pets it does not face forward and look where my character looks (It’s like my pets forward is not the characters forward so it is Aligning but not Aligning in the way I want it to)
Code(All Local for Testing)
local RunService = game:GetService('RunService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local Root = Character.HumanoidRootPart
local Pet = game.ReplicatedStorage.Part:Clone()
function SpawnPet()
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyPosition.P = 15000
BodyPosition.Parent = Pet
Pet.Parent = workspace
local function Pet_Follow()
BodyPosition.Position = (Root.CFrame * CFrame.new(5, 3, 5)).p
end
RunService.Heartbeat:connect(Pet_Follow)
end
SpawnPet()
I’m going to make a pet system once I figure out this Orientation problem and post it somewhere in the dev forums due to people wanting a pet system that’s actually smooth and doesn’t lag/stutter
If anyone has a solution, or a way to make the Align Orientation work properly post below
How exactly would you do that in this case, I added a BodyGyro and set its CFrame to my RootPart’s CFrame and parented it to the pet and it did nothing, am I not doing it properly?
You can manipulate BodyGyro to make your pet turn smoothly, with the following properties:
bg.D : Determines the amount of dampening to use in reaching the goal CFrame
bg.P : Determines how aggressive of a torque is applied in reaching the goal orientation
I believe in the screenshot you provided, you can see how fast your pet changes its face direction.