With the new 2d features i have made a character that can move left and right.
i use this script that i made:
var mSpeed : float = 0.1;
function Start () {
}
function Update () {
if(Input.GetButton("right"))
{
transform.Translate(Vector3(mSpeed,0,0) * Time.deltaTime);
}
if(Input.GetButton("left"))
{
transform.Translate(Vector3(-mSpeed,0,0) * Time.deltaTime);
}
}
Nothing special, you can't jump but i make that when i find out how to. But thats not the question.
My character also has a 2Drigidbody, and when i walk into an object and hold the button
the player "lags". I can't really find a word for it.
But the player goes like a little bit into the object and then out of it to noraml again. And this happens about 5 times every second. until i release the key.
I hope you understand what i mean.
↧