Tuesday, October 21, 2025
spot_img

Why is my automobile not transferring once I press the buttons? I am unable to see any motive it should not


The "Automotive" in query is a airplane. The query is fairly self explanatory.

Here is the Automotive within the Hierarchy:

Why is my automobile not transferring once I press the buttons? I am unable to see any motive it should not

Here is the automobile within the inspector:

Unity Inspector

And here is the PlayerMovement script:

utilizing UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    // --------------------------------
    // References
    // --------------------------------
    public Rigidbody rb;
    // --------------------------------

    public float pressure = 500f;

    void FixedUpdate()
    {
        if (Enter.GetKey("w") || Enter.GetKey("up"))
        {
            Debug.Log("Foreward");
            rb.AddForce(0, 0, pressure * Time.deltaTime);
        }
        if (Enter.GetKey("a") || Enter.GetKey("left"))
        {
            rb.AddForce(-force * Time.deltaTime, 0, 0);
        }
        if (Enter.GetKey("s") || Enter.GetKey("down"))
        {
            rb.AddForce(0, 0, -force * Time.deltaTime);
        }
        if (Enter.GetKey("d") || Enter.GetKey("proper"))
        {
            rb.AddForce(pressure * Time.deltaTime, 0, 0);
        }
    }
}

It does present the "Foreward" log once I press W or up arrow, so I do know that is working.

(Facet notice: I do know this would possibly not get me precise automobile physics, I am simply attempting to ensure I can transfer the automobile in any respect first)

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles