How not to penetrate the walls?

I use the following code to move my character

transform.position + = new Vector3 (x * Time.deltaTime, 0, y * Time.deltaTime);

However, if the crash barrier, will penetrate and bounce
I studied ‘Standard Assets Example Project’ but no harvest

by editing the position of your character, that’s all you’re doing, changing his position without being cognizant of collisions.

Add a character controller and use the .Move() function to control your character. This will check for collisions and stop accordingly.

I don’t know what your scene looks like, but a common problem is that the character is moving so fast, that the character moves past the wall in between two physics updates, so the character has past the wall before the next update. If that is the problem, making the wall (or otherwise the collider) thicker or limiting the speed of your character should solve the problem.

a common cause is that “Drag” property on your RigidBody is 0. so it bounces and slides indefinitely.
try 1 or 2. since you don’t use AddForce for moving you Object, it doesn’t affect physics.
with drag set to 1, it will stay still after a little Bounce.

Note : you need a non-kinematic rigidbody and a non-trigger Collider to avoid penetration.