Wednesday, March 16, 2016

Jumping Code For Unity

public float jumpspeed;

       //In Fixedupdate

        if(Physics.Raycast (gameObject.transform.position, Vector3.down, 3)&&Input.GetKeyDown(Keycode.Space)) 
        {
            rb.AddForce(Vector3.up * jumpspeed);
        }

1 comment:

Rose Hannaquist said...

I put this code in all the right places and came up with 3 errors:
Argument '#1' cannot convert 'object' expression to type 'string
The best overloaded method for 'UnityEngine.Input.GetKeyDown(string)' has some invalid arguments
The name 'Keycode' does not exist in the current context

No one is here right now who can help me out personally.
I am very frustrated so I am leaving a comment here.