I’m having a similar problem. I want to avoid using physics and make a jump that will be realistic using the following code. But I can’t find the problem here
• Also, I’m trying to have the player move forward/back, turn, and do a single jump with a realistic arc
:
First of all, please use Code Tags instead of posting files.
Secondly, please create a new thread unless it’s something which contributes to the actual topic/issue.
Your code looks a little inconsistent as to how you calculate the values unless that’s your intention.
E.g. your forward velocity is just set to your raw speed, backward velocity is speed*Time.deltaTime, your rotation is done without Time.deltaTime and the jumping with Time.deltaTime again.
You should be doing it the same way all the time, otherwise it’s really confusing.
One common way is to calculate the abosulte movement Vector first and multiply it by Time.deltaTime when everything else has been done.
Also, your backward velocity will be a forward velocity due to minus&minus which equals plus.
The code for jumping will probably not have any great effect as you only add the up velocity in a single frame (when the key is pressed down) while you decrease it by a much larger value all the time.
There’s already a basic and working jump speed calculation in the scripts above, you may have a look at it.
Last but not least the argument in the controller.Move(…) looks a little strange, it’s basically 2* one of the summands.