public class PlayerController : MonoBehaviour
{
private Rigidbody playerRb;
public float floatForce ;
void Start()
{
playerRb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.Space))
{
playerRb.AddForce(Vector3.up*floatForce, ForceMode.Force);
}
}
}
getkeydown was my first attempt writing the code,so i tried different things like getkey and left it there since it was all the same and giving me that weird issue
Thanks! this was true, however the challenge itself never thought us to put physics related code into fixedupdate but their project did not have the above issue putting the code in normal update. so its weird,especially for a beginner that doesn’t know about this.