The effect of Vector3.Lerp won’t apply to my character. I’m building 2D game. PLEASE HELP!!!
using UnityEngine;
public class CharacterController : MonoBehaviour {
public float maxSpeed = 10f;
public float JumpForce = 8f;
public float smooth = 2f;
float step;
// Use this for initialization
void Start () {
}
// Do Graphics and Inputs here
void Update () {
step = maxSpeed * Time.deltaTime;
if(Input.GetMouseButtonDown(0))
{
Vector3 vektor = transform.position;
vektor.y =JumpForce;
transform.position = Vector3.Lerp(transform.position, vektor, Time.deltaTime * smooth);
}
}
// Do physics here
void FixedUpdate()
{
float move = Input.GetAxisRaw("Horizontal");
rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
}
}