I wanna make a driveable boat but I have no idea how I can make one. I tried learning to by using freemodels like the cars you’d see in the places roblox offers you but I understood no math behind it. Can anyone help?
1 Like
Alright, I got you.
Here is guide how to make boat. WIth explanations
1. Creating the Boat Model
- Build the Hull: Start by designing a basic hull for your boat. You can use a simple rectangular part or a more detailed model.
-
Add a Motor: Attach a part or a
BodyVelocity
to represent the boat’s motor. This will be responsible for moving the boat forward.
2. Implementing Buoyancy
- Buoyancy is what keeps your boat floating on water. You can achieve this by using
BodyForce
orBodyPosition
objects that apply an upward force to counteract gravity. -
Script Example:
local boat = script.Parent local buoyancyForce = Instance.new("BodyForce", boat) local waterDensity = 1 -- Adjust based on the water you're using local boatMass = boat:GetMass() buoyancyForce.Force = Vector3.new(0, waterDensity * boatMass * workspace.Gravity, 0)
3. Adding Movement
-
Forward Movement: Use a
BodyVelocity
orLinearVelocity
object to move the boat forward. You can control the speed based on player input. -
Steering: Implement steering by applying torque to the boat. This can be done using a
BodyAngularVelocity
object. -
Script Example:
local boat = script.Parent local velocity = Instance.new("BodyVelocity", boat) local angularVelocity = Instance.new("BodyAngularVelocity", boat) local speed = 50 local turningSpeed = 10 velocity.Velocity = boat.CFrame.LookVector * speed -- Steering based on input (WASD or arrow keys) local function onSteer(input) if input == "Left" then angularVelocity.AngularVelocity = Vector3.new(0, -turningSpeed, 0) elseif input == "Right" then angularVelocity.AngularVelocity = Vector3.new(0, turningSpeed, 0) else angularVelocity.AngularVelocity = Vector3.new(0, 0, 0) end end
Also, if you didn’t understand, I found a video for you https://www.youtube.com/watch?v=sa6YAw7e39A&pp=ygUtaG93IHRvIG1ha2UgYSBkcml2YWJsZSBib2F0IGluIHJvYmxveCBzdHVkaW8g
I hope it will help you! Good luck!
I’ll check it out! But I also wanna ask, can you use any type of force on anchored parts or does it have to be unanchored?
1 Like
Such as BodyVelocity
, BodyForce
, BodyGyro
, etc., only affect unanchored parts.