Hello, I’ve spent the past couple of months modeling boats, and now i’m trying to script them.
My scripting knowlegde isn’t good enough to use gerstner waves and apply buoyancy to the models, so instead I plan to just animate the effect instead. would animating a brick and welding it to the model suffice?
However I do not know how I would make the boat move forward upon a keypress, and contiue to move forward until another keypress, so the player doesn’t need to be sitting in a seat or holding W to make it move.
Any help would be greatly appreciated…
Thanks in advance.
I recommend you check out the documentation for either userinputservice or contextactionservice, there are many tutorials on how to read player inputs using these two services.
As for moving the boat, it depends on whether or not your board is anchored. If it isn’t, you could try applying velocity to the boat each frame if the forward key is pressed down (or other physics-based equivalents). If your boat is anchored, you’ll have to move the boat manually each frame while keeping track of framerate so a player running at 60 fps doesn’t have a boat going twice as fast as a player going 30 fps.
I’ve looked at some sources, but they only show the brick going forward a set amount of studs, is there any way i can make it go continuously until stopped with a keypress?
(my last post was about buoyancy where i didnt read everything)
for movement what i do is have a rudder in the back that can move left and right then you have a vector forcr in the back of that, that will push the boat forward (times its velocity by the assembly mass)
for turning if you have water drag built in your buoyancy system it should turn it otherwise use a torque in the middle of the boat then when pressing A or D apply a torque in that direction
if you use a torque force you will not need the rudder to move left and right
You’d have a variable saying whether or not the forward key is pressed somewhere, and pressing forward would set that variable to be true and releasing forward would set it to false.
You’d then update the position of the part every frame based on whether or not this “forward” variable is set to true.
Frame 1:
Is the player pressing forward? Yes? Move boat (number) studs.
Frame 2:
Is the player pressing forward? Yes? Move boat (number) studs.
Frame 3:
Is the player pressing forward? No? Don’t move the boat.