Hey there gents! I had a really quick simple question about jumping via forces. I was prototyping a simple runner type game and ran into some issues adding jumping. Here is what I am working with Code (csharp): void Update () { Vector3 myPos = transform.position; myPos.z = zLock; transform.position = myPos; //if (Input.GetKeyUp(KeyCode.Space)) rigidbody.AddForce(Vector3.right * forceMulti); rigidbody.AddForce(Vector3.right * forceMulti); if (Input.GetKeyDown(KeyCode.Space)) { rigidbody.AddForce(Vector3.up * jumpMulti); Debug.Log("I'M JUMPING OMG!!"); } } I get the debug print for the jump but the Y position of the character is basically totally constant. Thanks for the help!
use Rigidbody.velocity instead you will get your desired result also you will need to have a function that detects if your character is touching the ground otherwise this will be a flying script
WEEEEEEEEEE FLYING!!!! I'll probably end up creating a state system for grounding and etc. I just wanted to kinda get a basic model of a object flying forward first. Thanks!
I figured I would just come back in and say that the issues was with the forcetype I was trying to apply. Using the default force was not sufficient to accelerate the object. One I change the force type to impulse I had jumping!