Hello, I’m trying to make a ship in the ocean and it has to collide with the continents, but I can’t get it to move good, with transform.translate it ignores the colliders and I tried using rigidbody.MoveTowards but then I can’t control the rigidbody’s direction this is my script:
function Update () {
rigidbody.rotation = transform.rotation;
var forward = Vector3.right * -Speed;
if(Input.GetAxis("Vertical")){
transform.rigidbody.MovePosition(rigidbody.position + forward * Time.deltaTime);
}
var rotate = Input.GetAxis("Horizontal") * RotSpeed * Time.deltaTime;
transform.Rotate(0, rotate, 0);
}
I need to finish this pretty quick so plz react quickly, thanks in advance.
Hybris
SOLVED: What I did is combine transform.translate with a rigidbody component to the object, I gave the rigidbody a “mass” of “Infinity” and disabled “use gravity”
Thank you guys for answering so quick.