-
I want to use the ControllerManager object in Roblox to make a part float(the part is connected to the player with a AlignPosition and AlignOrientation).
-
The problem is the ControllerManager doesn’t allow me to change the orientation of the part, or :ApplyImpulse on the part. I only want to use the ControlleManager for the floating.
-
I tried looking on the DevForum and searching up how I could acheive this but I couldn’t find a solution
Here is the code applying the impulse and rotating the player
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)
self.MoveVector = Vector3.new(self.Humanoid.MoveDirection.X, 0, self.Humanoid.MoveDirection.Z)
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)