Repulsion Vectors

I have been working on a much cheaper pathfinding script it uses repulsion vectors to steer an object away from an obstacle. It is working really well so far but I have an issue. Once it enters the field where it needs to steer away it becomes jittery becasue it leaves, then enters, leaves then enters.

The it is set up I have to areas around the obstacle, 1 area lightly pushes the object away so things can still move near it “like walking beside a building”. 2 is for GET OUT and will force the object away, like trying to walk through a building.

I believe area 1 is working in the exact same way as area 2 making it bounce in and out thus jittering.

Any help would be great, thank you.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Repulsion_Vectors : MonoBehaviour {
	
	public GameObject target;
	
	public GameObject obstacle;
	
	public Transform body;
	public Transform compass;
	
	public float distance;
	public float speed = 10;
	public float turnSpeed = 10;
	
	public CharacterController controller;
	

	// Update is called once per frame
	void Update () 
	{
		distance = (transform.position - target.transform.position).magnitude;
		
		float obstacleDistance = Vector3.Distance(obstacle.transform.position, transform.position);
		
		Vector3 dir = (target.transform.position - transform.position).normalized;
		
		float direction = Vector3.Dot(dir, transform.forward);
		
		if(direction > 0)
		{
			if(obstacleDistance <= 5)
			{
				dir += (transform.position - obstacle.transform.position).normalized;
			}
			else if(obstacleDistance > 5  obstacleDistance < 15)
			{

				dir += ((transform.position - obstacle.transform.position)).normalized;
				dir = dir / 2;
			}
		}
		
		dir *= speed * Time.fixedDeltaTime;
		
		transform.rotation = Quaternion.LookRotation(dir);
		
		controller.SimpleMove(dir);

	}
}

Here is the latest version

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//9vt8w
public class Repulsion_Vectors : MonoBehaviour {
	
	public GameObject target;
	public GameObject obstacle;
	
	public Transform body;
	public Transform compass;
	
	public GameObject ObjectManager;
	
	public float distance;
	public float speed = 10;
	public float turnSpeed = 10;
	
	public CharacterController controller;
	Grid_Master grid_Master;
	
	void Start()
	{
		
		grid_Master = ObjectManager.GetComponent<Grid_Master>();
		
	}
	
	// Update is called once per frame
	void Update () 
	{
		//direction from us to target in a staight line
		Vector3 dir = (target.transform.position - transform.position);
		//reference grid master
		
		
		//loop through all known obstacles
		
		for(int cnt = 0 ; cnt < grid_Master.obstacles.Count ; cnt++)
		{
			
			//reference current obstacle
			obstacle = grid_Master.obstacles[cnt];
			
			//distance to us to the target
			distance = (transform.position - target.transform.position).magnitude;
			
			//distance from us to this obstacle
			float obstacleDistance = (this.transform.position - obstacle.transform.position).sqrMagnitude;
			
			//based on our current movement where are we in relation to the object
			float direction = Vector3.Dot(dir, transform.forward);
			
			//if object is not behind us
			if(direction > 0)
			{
				//if we are close enough to the object to care
				if(obstacleDistance <= 10)
				{
					//we are so begin moving away
					//beacause we are in the 'inner range' we care morea bout moving away
					//length (strength) of repulsion vector increased slightly
					dir += ((transform.position - obstacle.transform.position)*1.25f);
				}
				else if(obstacleDistance > 10  obstacleDistance < 20)
				{	
					//we are close to an object so try and move away
					//we are in 'outer range' we know there is still time
					//lenght (strength) of repulsion vector halved as we don't care if we get closer
					dir += ((transform.position - obstacle.transform.position) /2);
				}
			}
		}
		
		//all of our avoidance is now taken into account in dire
		
		//dire needs to be normalised before use
		dir.Normalize();
		
		//prepare dire to become movement vector
		//incorporate speed and smooth by DT
		dir *= speed * Time.fixedDeltaTime;
		
		//rotate to lookat dir
		
		//currently causes obscene shaking, needs smothing
		/////check function rotatetowards
		transform.rotation = Quaternion.LookRotation(dir);
		
		//move
		controller.SimpleMove(dir);
	}
}

For some reason running this script gives me frame rate around 40 and not running it gives me frame rates of over 150.
So it doesnt seem to work which is odd I had it working before even if it was jittering.

Can anyone help?