Question by
Skyflamme · Nov 02, 2020 at 10:04 AM ·
player movement
Failure by collision with wall,Failure in collision with the wall
I have a problem because when the player (cube) collides with the wall, he trembles around. Can someone help me??
[RequireComponent(typeof(Rigidbody))]
public class Movement : MonoBehaviour
{
public float speed;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal") * Time.deltaTime * speed;
float vertical = Input.GetAxisRaw("Vertical") * Time.deltaTime * speed;
transform.Translate(horizontal, 0, vertical);
}
}
Comment
Your answer