Hi, I am currently having a problem with a control system I made that uses Vector3.Slerp. For some reason, it is acting quite strange. Code (csharp): using UnityEngine; using System.Collections; public class controls : MonoBehaviour { public float target; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown (KeyCode.A) && target > -1){ target -= 1; } if(Input.GetKeyDown (KeyCode.D) && target < 1){ target += 1; } transform.position = Vector3.Slerp (new Vector3(transform.position.x,0,0), new Vector3 (target, 0, 0), 0.1f); target = Mathf.Clamp (target, -1, 1); } } I have put this code on a cube without a rigidbody, and with a box collider.
It's probably the Slerp - try Lerp - Slerp will interpolate between the (changing) values between from and to, and potentially change other axis you don't intend to change. And, instead of 0.1f you might consider using Time.deltaTime * speed.