I have a Titan Npc which uses MoveTo() to go to the nearest character - this is updated within a heartbeat every so often (rate limited). The NPC also uses a body gyro to face in the direction it is moving/look at the enemy character.
When I go under its legs I get flinged of the map after a short while. Any one know how to resolve this?
Clip:
Titan:New()
--// More code above
local TG = newTitan.Rig.PrimaryPart:FindFirstChild("TitanGyro")
if not TG then
TG = Instance.new("BodyGyro")
TG.Parent = newTitan.Rig.PrimaryPart
end
TG.D = 1890
TG.P = 31000
TG.MaxTorque = Vector3.new(1e5, 1e5, 1e5)
newTitan.TG = TG
Humanoid.AutoRotate = false
newTitan:Start()
return newTitan
end
function Titan:MoveTo(Chasing, Position)
self.Rig.Humanoid.WalkSpeed = self.CustomSpeed or (Chasing and TitanSpecs.WalkSpeeds[self.TitanType]["Chase"] or TitanSpecs.WalkSpeeds[self.TitanType]["Patrol"])
if Position then
local currentPosition = self.HumPart.Position
self.Rig.Humanoid:MoveTo(Position)
self:Walk(not Chasing)
self.TG.CFrame = CFrame.new(currentPosition, Vector3.new(Position.X, currentPosition.Y, Position.Z))
else
self.Rig.Humanoid:MoveTo(self.Rig.PrimaryPart.Position)
self:Idle()
end
end