My Deep Problem (Collision)

My problem is when i want to use codes for moving like this picture and when receive to the two sides it stop moving!!

but when I want to use colliders and triggers most of time the player don’t stop and when I use raycast but after 4 or 5 touch it don’t stop player :rage:
Can any body Show me a better way to do this work?
my other problem is this message "[mecanim]: BindSkeleton : cannot find Transform ‘Plane02’ "
that don’t release me i don’t use any mecanim !! :rage:
thanks

Your problem is that you are trying to use physics to control something that should be controlled by mathematics.

var min:float = -20;
var max:float = 20;
var speed:float = 5;

var input:float = Input.GetAxis("Mouse Y") * speed;
var pos:Vector3 = transform.position;

pos.x = Mathf.Clamp(pos + input, min, max);

transform.position = pos;

If you are going to use physics, it may be handled differently.

rigidbody.constraints = FreezePositionY | FreezePositionZ;

var pos:Vector3 = transform.position;

pos.x = Mathf.Clamp(pos, min, max);

transform.position = pos
// this basically locks the Y and Z and you put "bumpers" to stop a the colliders of the players. You can even have it bounce if needed.
rigidbody.constraints = FreezePositionY | FreezePositionZ;

var pos:Vector3 = transform.position;

pos.x = Mathf.Clamp(pos, min, max);

transform.position = pos
// this basically locks the Y and Z and you put "bumpers" to stop a the colliders of the players. You can even have it bounce if needed.

A lot of thanks dear friend !! :smile: