- Home /
Jump forward without moving?
Hi, this is my first post on UnityAnswers and I'm working on a first person racing game where you can only jump. Well that's the premise of it. I've got the basic move script but i can also use the CharacterMotor script if necessary.
My question is what would I add to the script to make the character jump in the air but also forward with space bar and no other buttons or outside forces?
Thanks in advance, Ex
I've edited the movescript to jump on x axis also but is there any way to make the player jump in the direction of the center of the screen when spacebar is pressed?
Answer by $$anonymous$$ · Dec 05, 2015 at 01:46 AM
The question is a contradiction. Jump forward without moving is like clapping hands without movement.
If you just want an up and down jump in place
just use:
void Update()
{
CharacterController controller = GetComponent<CharacterController>();
`if (controller.isGrounded)`
if (Input.GetButton("Jump"))
moveDirection.y = jumpSpeed;
}
otherwise it sounds to me like you are moving the world/area around and just having the vehicle hop in place.
If you have a race track and you already have the movements to "drive the vehicle all over the place, it would be much easier and less coding just to create a Player Camera and move it to the positioning view you want or use some sort of follow player function on the player cam (not the main cam).
Your answer
Follow this Question
Related Questions
Jump Script ow to make it??? 2 Answers
Making a "vault over an obstacle" script 0 Answers
Different values of force applyed with AddForce don't change the speed of the gameobject 0 Answers
Creating A wall Jump 0 Answers
Simple jump code? 2 Answers