I need help with a little ,water current" script.In my game I have a ship and when that ship enters the water current the ship’s speed increases…Here’s an example of my code,it’s not the full code just an example…
function OnTriggerEnter () {
boatSpeed = 7;
}
function OnTriggerExit() {
boatSpeed = 5;
}
But how do I make the water currents to behave naturally,moving the boat without the player’s input and make it move with the water current direction…just make it behave naturally.
I’m not asking for code,I’m just asking how do it.
I believe your best solution requires the use of forces and rigidbodies.
In particular, regardless of how you implement your currents, what you need is a trigger collider which covers their boundaries, then, whenever the ship enters said colliders, you determine the current’s vector and multiply it by your ship’s controller direction, to eventually use the move or simplemove function and actually drive the ship.
There’s certainly many ways to achieve the same result, my proposal is one of the simplest.
wtf is that xD
– Anox