Rigidbody - Stop & Jump
Hello
I'm trying to make a character jump but every time I do it, the player stops moving and jump on the spot where he is.
I use this to move
if (IsGrounded == true) { translation = Input.GetAxis("Vertical") Speed; straffe = Input.GetAxis("Horizontal") SideSpeed;
translation *= Time.deltaTime;
transform.Translate(straffe, 0, translation);
}
and this to jump (I tried different version, always the same result.
if (Input.GetKeyDown(KeyCode.Space) && (CrouchMode == false) && (IsGrounded == true)) {
//rb.AddForce(transform.up * JumpForce, ForceMode.Impulse);
//rb.AddForce(new Vector3(0, JumpForce, 0), ForceMode.Impulse);
// rb.AddForce(new Vector3(ActualSpeed, JumpForce, ActualSideSpeed), ForceMode.Impulse);
}
Any ideas please ?
Your answer
Follow this Question
Related Questions
Issues Getting my GameObject to both Move Forward and Jump properly. 0 Answers
How can I move an object in the direction another object is facing. 1 Answer
Freezing an object and keeping it's velocity 1 Answer
rigidbody.AddForce doesn´t work in c# 1 Answer
Unity Annoyance with Physics Help C# Scripting Problem Momentum Issue Please Help 0 Answers