How do I make amazing momentum?

Hello, I have been coding something called ODM. Right now, you can orbit in a direction left or right or hook to a point.

However there is 0 momentum, after you let go, you simply fall. I don’t know what to do to fix this. I am using Linearvelocity for the movement and alignorientation to rotate the player towards the target.

Heres an example of what something could look like when I add momentum, smooth, it flings you up, leaning makes you fling to the right or left, and you don’t instantly fall.

External Media

Maybe add a force to keep the player in the air a bit longer like maybe a bodyvelocity?

Bodyvelocity is depracerated, is there an alternate one I could use? And how do I maintain momentum or fling players in directions?

Just because its deprecated doesn’t mean you can’t use it at all, well I’ve found that sometimes the newer forces that require attachments arent the best for the movement im trying to apply to a given scenrario as well

Can you show me some code to explain how I can pull this off?

How about let’s see your existing system and try to see what we can extract from it or put into it before we try writing it from scratch

function ODMModule.CreateMover(char,direction)
	local ForwardMover = Instance.new("LinearVelocity")
	ForwardMover.Name = direction.."_Mover"
	ForwardMover.Parent = Library.HumanoidRootPart 
	ForwardMover.RelativeTo = Enum.ActuatorRelativeTo.World
	ForwardMover.MaxForce = 100*1000
	ForwardMover.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
	
	local AlignMover = Instance.new("AlignOrientation")
	AlignMover.Name = direction.."_Mover"
	AlignMover.Parent = Library.HumanoidRootPart
	AlignMover.MaxAngularVelocity = 100*10000
	AlignMover.MaxTorque = 100*1000
	AlignMover.Responsiveness = 100
	AlignMover.Mode = Enum.OrientationAlignmentMode.OneAttachment
end

function ODMModule.MovePlayer(char,A0,A1,direction)
	local ForwardMover
	for i,v in pairs(Library.HumanoidRootPart:GetChildren()) do
		if v:IsA("LinearVelocity") and v.Name == direction.."_Mover" then
			ForwardMover = v
		end
	end

	ForwardMover.Attachment0 = A0
	ForwardMover.VectorVelocity = CFrame.lookAt(Library.HumanoidRootPart.Position,A1.WorldPosition).LookVector*ODMModule.GetSpeed(char)
end

function ODMModule.RotatePlayer(char,A0,A1,direction)
	local AlignMover
	for i,v in pairs(Library.HumanoidRootPart:GetChildren()) do
		if v:IsA("AlignOrientation") and v.Name == direction.."_Mover" then
			AlignMover = v
		end
	end
	AlignMover.Attachment0 = A0
	AlignMover.CFrame = CFrame.lookAt(Library.HumanoidRootPart.Position,A1.WorldPosition)
end

Here is the mover and rotation functions. Its called on by the client (optimization), upon letting go, a remove script sets all their values to nil, which is what is causing them to drop down I’d imagine.

function ODMModule.removeHook(direction,HRP)
	
	if direction == "Left" then
		Library.Values.LeftHook.Value = nil
	else
		Library.Values.RightHook.Value = nil
	end
	
	for i,v in pairs(HRP:GetChildren()) do
		
		if v.Name == direction.."_Mover" and v:IsA("AlignOrientation") then
			v.Attachment0 = nil
			v.Attachment1 = nil
		elseif v.Name == direction.."_Mover" and v:IsA("LinearVelocity") then
			v.Attachment0 = nil
			v.VectorVelocity = Vector3.new(0,0,0)
			task.wait(0.05)
		elseif v:IsA("Beam") then
			if v.Name == direction.."_Hook" then
				ODMModule.retreactTween(v.Attachment0,v.Attachment1,v,direction)
				v.Attachment0:Destroy()
				v.Attachment1:Destroy()
				v:Destroy()
			end
		end
	end
end

Well your setting the VectorVelocity to Vector3.zero, which is making them drop down rather quickly, how about you try tweening the VectorVelocity to Vector3.zero, using tweenservice

You shouldn’t use it at all.

I think an AlignPosition would work here

I will try that now then, this will give me the momentum feel?

1 Like

Well honestly for a small project im working on right now, I’m currently using BodyVelocity to move my player because it allows me to specify force on a specific axis, which I can’t do with the newer ones

Yeah so basically the higher the tween time the slower the player will fall

Alignposition for the actual movement or simply the ‘momentum’? I was talking originally about the actual movement.

AlignPosition will obviously move them.

elseif v.Name == direction.."_Mover" and v:IsA("LinearVelocity") then
			local goal = {}
			goal.VectorVelocity = Vector3.new(0,0,0)
			
			local tweenInfo = TweenInfo.new(0.25,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
			local tween = Library.Services.TweenService:Create(v,tweenInfo,goal)
			tween:Play()
			tween.Completed:Wait()
			v.Attachment0 = nil
		end	

I have done it however it simply is choppy and doesnt feel natural. Also, it flings you a lot, how do I fix that? https://gyazo.com/4a273781952928cce09f117bc45cab2d

Maybe try having something that will keep the player upright while using the ability and maybe try playing around with the tween time and the easing style

What could I use to keep the player upright?

You could use a body gyro they work really great, sorry for late reply

What you want to do is disable the physics on the Humanoid by setting its state to Physics. You’ll have complete control over the maneuvering that way, if you’re brave enough to try that because it’s a lot of physics to consider…

EDIT: It doesn’t have to be Physics the whole way, you can set it to Physics every time you know they’re on air for example.

How would I code it from there?