colliding problem

i have this AI and it will hit the main character. but when it hits the character the AI massively bounce away. i cant figure out how to stop the movement when it hits the character.

Neither can I, since I can’t see your code…

var waypoint:Transform[];
var speed:float=20;
private var cwaypoint:int;

function Update () {
	
	if(cwaypoint<waypoint.length){
		var target:Vector3=waypoint[cwaypoint].position;
		var moveDirection:Vector3=target-transform.position;
		
		var velocity=rigidbody.velocity;
		
		if(moveDirection.magnitude<1){
			cwaypoint++;
			animation.CrossFade("idle");
		}
		else{
			velocity=moveDirection.normalized*speed;
			animation.CrossFade("run");
		}
	}
	
	rigidbody.velocity=velocity;
	transform.LookAt(target);
}

sorry i forgot to post it.

so here is the code. it will follow the waypoint i put on the character to be followed.

I don’t see how the code relates to the question… there’s nothing in it that has anything to do with hitting the main character – or even any awareness of other game objects besides the waypoints. The code also looks to be broken, as the final two lines are using ‘target’ and ‘velocity’ variables that are out of scope.

Perhaps when you say ‘hit the main character’ you mean ‘reach a waypoint’ and the problem is that the AI continues moving past the waypoint? If so, that’s because you never set the velocity back to zero to halt the AI’s movement. But with the code as shown, I wouldn’t have expected the AI to start moving in the first place, since the only place rigidbody.velocity is assigned, the variable you’re assigning from is not valid…