so my script is:
public float speed = 50;
bool isinRL = true;
bool isinLL = false;
void Update ()
{
transform.Translate(0, 0, speed * Time.deltaTime);
if(isinRL && Input.GetKeyDown(KeyCode.A))
{
isinRL = false;
transform.Translate(-5, 0, 0);
}
if (isinLL && Input.GetKeyDown(KeyCode.D))
{
isinLL = false;
transform.Translate(5, 0, 0);
}
}
void IsInRL()
{
if(!isinRL)
{
isinRL = true;
isinLL = false;
}
}
void IsInLL()
{
if(!isinLL)
{
isinLL = true;
isinRL = false;
}
}
I need help finding out how I can make this part:
if(isinRL && Input.GetKeyDown(KeyCode.A))
{
isinRL = false;
transform.Translate(-5, 0, 0);
}
if (isinLL && Input.GetKeyDown(KeyCode.D))
{
isinLL = false;
transform.Translate(5, 0, 0);
}
}
when it says transform.translate, what I need help with is how do I move the character smoothly, because for me it just teleports there and anything else i try does not work, thanks!