Why when I put velocity.y my character goes on x coordinate, when I put velocity.y then he goes on x and y coordinate together, Why?
You’ll need to show your code so we can help you find the issue.
1 Like
code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Body : MonoBehaviour
{
public float speed = 5f;
private float movement = 0f;
new private Rigidbody2D rigidbody;
// Start is called before the first frame update
void Start()
{
rigidbody = GetComponent();
}
// Update is called once per frame
void Update()
{
movement = Input.GetAxis(“Horizontal”);
rigidbody.velocity = new Vector2(movement * speed, rigidbody.velocity.y);
}
}
i understand, what need TIME.deltatime but why?