Character mover accelerates infinitely

1.What I want to achieve
I want to make a custom character controller that can be rotated while still having the player move relative to its rotation

Drawing for visualization

  1. the issueplenty of videos ahead
    I’ve made this using a line force. The problem is that the character mover infinitely accelerates. I want the character mover to move at a consistent speed
Video example

  1. What solutions have I tried so far?

I have attempted multiple solutions. I’ll list these solutions and explain why I think i didn’t work

video example

Current version of the drag force script
while true do
	
	
	
	task.wait()
	local velocity = script.Parent.AssemblyLinearVelocity
	local speed = velocity.Magnitude
	local XZVector = 1
	script.Parent.PlrMoveTargetPart.Position = script.Parent.PlrMovementAttach.CamLookAwayAttach.SingleAxisRotate.MoveAtchParent.MoveGoal.WorldPosition
	
	--the drag force section
	if speed > 0.1 then
		script.Parent.DragForce.Magnitude = -(speed^2)
		print(speed)
	else
		script.Parent.DragForce.Magnitude = 0
	end
		

		
	
	
	
end

additional screenshot:

  • I previously used a different version of the script that used vector forces, and it worked perfectly fine until I rotated the player to move upwards. It would then infinitely accelerate upward
video example of it going upwards

    • I used the drag force script on this, and fixed the issue, but now the character mover glides down to the ground instead of falling like a normal physics object
video of it falling down slowly instead of falling down fast/normally as well as a bug I found

the drag force on the normal mover might not work if device is really laggy

I can fly when I apply drag force on every axis (specifically the Y axis), but I still glide down after a jump

The script for this version:

dragForce.Attachment0 = script.Parent.PlrMovementAttach
dragForce.Force = Vector3.new()
dragForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
dragForce.Parent = script.Parent
dragForce.Name = "DragForce"




while true do

	task.wait()
	local velocity = script.Parent.AssemblyLinearVelocity
	local speed = velocity.Magnitude
	local XZVector = Vector3.new(1,1,1)
	
	
	
	
	
	script.Parent.MoveForce.Force = script.Parent.PlrMovementAttach.CamLookAwayAttach.SingleAxisRotate.LookerAttach.WorldCFrame.LookVector*10000
	
	script.Parent.PlrMoveTargetPart.Position = script.Parent.PlrMovementAttach.CamLookAwayAttach.SingleAxisRotate.MovingAttachment.MoveGoal.WorldPosition
	
	--the drag force section
	if speed > 0.1 then
		dragForce.Force = -velocity.Unit*(speed^2)*XZVector
	else
		dragForce.Force = Vector3.new()
	end
	
		print(speed)
		

		
	
	
end

additional screenshot:

  • I’ve tried to use linear velocity with the LineForce constraint mode, but it wouldn’t rotate when I moved the camera (I have a script that rotates an attachment in the mover based on where the camera is looking).
  • I’ve tried adding a max force limit to the line force, but that still allowed the mover to accelerate infinitely, just at a slower pace
  • I once tried making the force be applied in an “equal” way rather than an “additive” way (example: I did speed = 25 instead of speed += 25) but that just made the part fall down slowly

I have no idea how to solve this. What can I do?

So what you’re trying to make is similar to how a airplane moves correct? Only moving in a straight line while being able to rotate the character?

One method is you could try looking up tutorials on how to script a plane and maybe use some of those scripts and apply it to your game.

Another method is using linear velocity and align orientation only without the line force. Linear velocity has multiple constraints where you can mimic the use of line force as shown in the image below:


Selecting the options(highlighted in red) you can have it move in 1D, 2D or 3D space.

Then you can use align orientation to change the direction of the character based on the camera’s rotation

Now I don’t have much experience with line force or whether or not it’s a much more viable option, but you can test if Linear Velocity works for you or not.

Third method would be to replicate how fly works. Here’s an example:


But instead of having the user move in multiple directions, you can just lock the forward key so it constantly moves in one direction. This one also uses align orientation(which rotates the character based on the camera’s rotation). So applying this should achieve a similar effect. I do have some code if you are interested in looking at for this particular method.

These are all just suggestions without any testing of course.

Also I noticed you went through a lot of effort into making this post and I felt kind of bad no one is really helping you out. Hopefully someone else sees this post and decide to help you out as well.