So Im doing some pets with OOP and I just did that they follow you and they look at you, the follow works perfectly, but the BodyGyro just does this thing.
This is the code:
self.Gyro.CFrame = CFrame.new(self.Gyro.Parent.Position,self.PartToFollow.Position)
1 Like
Hmm, looks like the axis are misaligned try rotating around the yaw by 90 degrees, might be due to the pet parts primary model Look vector not being the same as the Gyro CFrame:
--rotate 90 degrees along with the yaw
local rotationCF = CFrame.Angles(0,math.rad(90),0)
self.Gyro.CFrame = CFrame.new(self.Gyro.Parent.Position,self.PartToFollow.Position)*rotationCF
Edit: Or it may be the part to follow position relative to the Gyro position, hard to tell without any information.
2 Likes
Hmm it appears that isn’t the fix, it keeps doing the same thing, PartToFollow is the HumanoidRootPart of the player.
1 Like
Also by the way are you putting this CFrame into an update loop, this is because the position of the pet will keep changing and so does the humanoid root part. Consequently you will need to continually need to update the CFrame.
Yes I have it on a loop. To be specific a while loop.