Ship and terrain collision.Need help.

Hello

I am creating a smalll game where you can control ship and a chracter.

My problem is i have created islands using Unity terrain and I want the ship to collide with the terrain
(Stop moving when it hits terrain) instead the ship passes right through it.

In my script i move the ship with transform.Translate
and I move the player with Character controller.


I have tried to move the ship with rigidbody but then the collisions don’t work with the player.
I have also tried to move the ship with character controller but than collisions only work on the part of the ship where the character controller reaches with its radius.


Anybody knows how would i create these collisions ?

Transform.Translate just changes the transform.position to move an object. This is like ‘teleporting’ the object every frame so it will ‘teleport’ through the terrain without the Physics system interacting at all.

I suggest you use a rigidbody and mesh collider. In your scripts use Rigidbody.AddForce rather than Transform.Translate.