Grappling Hook

how can i create weapon that when it hist a wall it will pull the character (with character controller) to it.

You need to do a raycast.

// Raycast up to 100 meters forward
var GrapplingHitPoint;
function FireGrapple () {
 var hit : RaycastHit;
 if (Physics.Raycast (transform.position, Vector3.forward, hit, 100.0)){
  GrapplingHitPoint = hit.point;
 }
}

Then Lerp Me toward GrapplingHitPoint

//Pulls Me to the target position like a spring
var smooth = 5.0;
function GrappleMeToPoint () {
transform.position = Vector3.Lerp (
transform.position, GrapplingHitPoint,
Time.deltaTime * smooth);
}

GrappleMeToPoint() will need to be in Update() with a flag OR switch case to turn it on and off - else you will just be stuck to the GrapplingHitPoint OR if it’s not in Update it will only move one frame towards the GrapplingHitPoint.

Cheers,