-
I’m trying to make a custom character controller which stays a little bit above the ground at all times using a ControllerManager and is moved by :ApplyImpulse()
-
The issue is, the CharacterController wont move after I added the ControllerManager, but before it would move
-
I’ve tried changing properties of the ControllerManager, and looking on the DevForum but I cant find anything.
Here is the code for movement:
RunService.PostSimulation:Connect(function(delta)
if not self.Humanoid.GroundSensor.SensedPart then return end
local goalVel = self.MoveVector * self.Humanoid.Property.WalkSpeed * self.Humanoid.SpeedFactor
self.CurrentVel = self.CurrentVel:Lerp(goalVel + self.Humanoid.GroundSensor.SensedPart.AssemblyLinearVelocity, self.Humanoid.Acceleration * delta)
local requiredForce = (goalVel - self.Humanoid.CharacterController.AssemblyLinearVelocity) / delta * self.Humanoid.Character.HumanoidRootPart.AssemblyMass
self.Humanoid.CharacterController:ApplyImpulse(requiredForce * delta)
--if self.MoveVector ~= 0 then
self.MoveVector = Vector3.new(self.Humanoid.MoveDirection.X, 0, self.Humanoid.MoveDirection.Z)
--self.MoveDirection = Vector3.new(self.Humanoid.MoveDirection.X, 0, self.Humanoid.MoveDirection.Z) * (fps * delta) * self.Humanoid.Property.WalkSpeed
if self.MoveVector.Magnitude ~= 0 then
self.Humanoid.CharAlignOrientation.CFrame = CFrame.lookAt(Vector3.zero, self.MoveVector)
end
--end
end)