Colliders sometimes not working and unwanted force

Hi Guys,

OK I’m sure I’m doing something wrong here but sometimes I can move clean through colliders. Especially when they are perpendicular to my angle of movement. This sometimes even works on the terrain if I hit it at the wrong angle. I’ve recorded the effect here and shown what settings I’ve got on.

https://youtu.be/dWc0YbfymRw

Secondary to that the collisions give the model unwanted force (I’m using translate to move the player)…I’m guessing that’s best addressed in script?

Sorry I’m quite new to Unity so I’m not sure what I should be addressing using the physics engine and what should be dealt with in script.

Any help you can give will be massively appreciated.

First, always use force to move objects if you want the physics system to know about it. Definitely use force to control the player ship, using Translate can cause it to (you guessed it) translate right through a wall, because Transform.Translate is just straight-up teleportation.

The other issue is that the collider on your ship has Discrete collision detection. Change it to Continuous Dynamic (because it’s always moving and you don’t want it to go through things) and you’ll have better results.

That unwanted force you’re seeing on a collision is from the collider partially clipping into another one and the physics engine causing it to be spit back out. Using force to control the ship should stop that, and making a Physics Material and assigning it to objects will let you control collision effects as you like (so you could have a trampoline object that bounces the ship and have everything else have a coefficient of restitution of 0).