Body velocity movement for player controlled vehicle

Hello everyone, I’m trying to create a player controlled hot air balloon and so far It’s going pretty well, I’m using a body velocity to handle it’s movement.

The issue is that I do not know how to make this movement accurate, I can use the roblox control module to get the players current input and translate that into Look & RightVector to achieve the desired effect, however, the way I’m achieving that doesn’t allow the balloon to travel in any other directions other then exactly forward backward, left and right, no diagonal, which would be especially annoying to mobile users.

I’ve tried multiple times in the past at fixing this issue but this is one of my first times using body movers so I’m a bit confused, anyway, here’s my bad approach:

connection = RS.Heartbeat:Connect(function()
	if hum and hum:GetState() == Enum.HumanoidStateType.Seated then
			
		local CurrentVector = ControlModule:GetMoveVector()
			
		if CurrentVector.Z > 0 then
			
		    BodyVelocity.Velocity = Vector3.new(-Prime.CFrame.LookVector.X * 10,BodyVelocity.Velocity.Y,-Prime.CFrame.LookVector.Z * 10)

				
		elseif CurrentVector.Z < 0 then
			BodyVelocity.Velocity = Vector3.new(Prime.CFrame.LookVector.X * 10,BodyVelocity.Velocity.Y,Prime.CFrame.LookVector.Z * 10)
			
			
		elseif CurrentVector.X > 0 then
			
			BodyVelocity.Velocity = Vector3.new(Prime.CFrame.RightVector.X * 10,BodyVelocity.Velocity.Y,Prime.CFrame.RightVector.Z * 10)
				
		elseif CurrentVector.X < 0 then
			BodyVelocity.Velocity = Vector3.new(-Prime.CFrame.RightVector.X * 10,BodyVelocity.Velocity.Y,-Prime.CFrame.RightVector.Z * 10)
				
		else
			BodyVelocity.Velocity = Vector3.new(0,BodyVelocity.Velocity.Y,0)
		end

2 Likes

I’ve used VehicleSeats to control bulldozer tracks and other vehicles so forgive me if I’m way off base here but don’t you need to script if the player is pressing FWD only or FWD and LEFT or RIGHT then calculate those inputs into your formula?
Since the WASD or arrow controls get converted to 0 and 1 or -1 you need to put some more lines like:
elseif CurrentVector.X > 0 and CurrentVector.Z < 0 then yada yada yada

Similar to a Roblox Car, when you press W and A the car veers left, not spins to the left.

1 Like

Oh, right. Thank you for your help. I didn’t consider that for some reason, my bad. :smile:

1 Like