I have just encountered error CS1504: argument 4: cannot convert from 'int' to 'UnityEngine.ForceMode'in Unity.
This is the coding that I have written
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
// This is a reference to the Rigidbody component called "rb"
public Rigidbody rb;
public float forwardForce = 2000f; // Variable that determines the forward force
public float sidewaysForce = 500f; // Variable that determines the sideways force
// We marked this as "Fixed"Update because we
// are using it to mess with physics.
void FixedUpdate()
{
// Add a forward force
rb.AddForce(0, 0, forwardForce * Time.deltaTime);
if (!Input.GetKey("d")) // If the player is pressing the "d" key
{
}
else
{
// Add a force to the right
global::System.Object value = rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, 50);
}
if (Input.GetKey("a")) // If the player is pressing the "a" key
{
// Add a force to the left
global::System.Object value = rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, 50);
}
}
}
Can Somebody help me out and point out what I have done wrong?