**In trying to make a jumping script in C#, I ran across this error:**
*error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.velocity'*
**This is my program:**
using UnityEngine;
using System.Collections;
public class Jump : MonoBehaviour {
public float JumpHeight = 8.0f;
private bool isFalling = false;
void Update () {
bool jump = Input.GetAxis("Jump") != 0;
if (jump && isFalling == false)
{
Vector3 velocity = Rigidbody.velocity;
velocity.y += JumpHeight;
Rigidbody.velocity = velocity;
isFalling = true;
}
}
void OnCollisionStay ()
{
isFalling = false;
}
}
**It would be very helpful if you could help me...**
**Thanks**
↧