Help with ControllerManager (MovingDirection and UpDirection)

Good to see you’ve found yourself a solution :eyes:!

I’m gonna show you how I do mine in case it helps out with any understandings. My code was originally sampled from the example project file officially provided by Roblox when the ControllerManager system was announced on this forum, but has been adapted to my custom character control class. (Link to original post)

This function is bound to RenderStepped (and is within a custom class object hence self).

local function UpdateMovementDirection()
	self.movementData = self:GetMovementData()

	local inputDir = self.movementData.inputDirection
		
	self.Character.controllers.manager.MovingDirection = inputDir

	if inputDir.Magnitude > 0 then
		self.Character.controllers.manager.FacingDirection = inputDir
	else
		if self.Character:IsControllerActive(self.Character.controllers.manager.SwimController) then
			self.Character.controllers.manager.FacingDirection = self.Character.controllers.manager.RootPart.CFrame.UpVector
		else
			self.Character.controllers.manager.FacingDirection = self.Character.controllers.manager.RootPart.CFrame.LookVector
		end
	end
end
1 Like