Help

Joined
May 9, 2022
Messages
3
Reaction score
0
I started learning unity coding in c# today. I am following a tutorial from a youtuber's playlist. I have copied all the code but when I start on unity I have a problem. I have code that makes a cube have force. However, the cube does not launch. here is the code:

using UnityEngine;

public class PlayerMovment : MonoBehaviour {

public Rigidbody rb;

public float fowardForce = 2000f;

// Update is called once per frame
void fixedUpdate()
// use Time.deltaTime to sync frames with force
{
rb.AddForce(0, 0, fowardForce * Time.deltaTime);

if ( Input.GetKey("d") );
{
rb.AddForce(500 * Time.deltaTime, 0, 0);
}
}
}

Any idea what the problem is? Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top