#Car Movement

1 messages · Page 1 of 1 (latest)

dreamy frigate
#

debug the move variable

dry sapphire
#

how can i do that?

dreamy frigate
#

debug.log(move)

dry sapphire
#

so this is my code atm ```cs
[RequireComponent(typeof(Rigidbody))]
public class CarMovement : MonoBehaviour
{
[SerializeField]

private Rigidbody rb;

Vector3 move;

public float speed;

void Start()
{
    rb = GetComponent<Rigidbody>();
}

void Update()
{
    float dx = Input.GetAxis("Horizontal");
    float dy = Input.GetAxis("Vertical");

    move = new Vector3(dx, 0.0f, dy);
    rb.AddForce(move * speed);
}

}``` where abouts should i put the (debug) debug.log(move)

dry sapphire
#
void Update()
    {
        float dx = Input.GetAxis("Horizontal");
        float dy = Input.GetAxis("Vertical");

        move = new Vector3(dx, 0.0f, dy);
        rb.AddForce(move * speed);
        debug.log(move);
    }```
dreamy frigate
#

do u have ur ide configuerd

#

does it auto fill code

dry sapphire
#

i dont think so, i always get this message when i open vscode for unity

dreamy frigate
dry sapphire
#

wouldnt i be able to do this in vscode though?

dreamy frigate
#

you could but for the future vs is way better

#

and you wouldnt even have this issue

#

Debug.log

#

capital d

dry sapphire
#

the values change to 1.0 or -1.0 when i press. the keys but the car doesnt move

dreamy frigate
#

now we know part of the issue