Jumping behaviour

SigmaVulcan

New member
Depending on the frames of the game my character jumps as high as 3 times the size of his own body.
It happens while the character is walking or sprinting, never during standing jumps.
Also it seems that in these instances the character is falling rather slow. Almost feels like the gravity has changed, at least a little bit.
This unpredictable jump behaviour makes it unsuable for me at the moment.

(Tried it with both update locations in the locomotion component: update and fixed update. My active movement type is third person adventure)

1598012286793.png

1598012325982.png

1598012527380.png
 
The jump ability continuously adds a force for as long as the Force Hold/For Damping Hold is held down.
 
Yes. But that doesn’t solve my problem. I press space as fast as I can and release it as fast as possible and still sometimes my jump goes 1 meter high and lasts half a second (duration) and sometimes my jump goes as high as 2.5 meters and lasts longer then a second. And if my frame rate is really good then my jump only goes like 0.5 meters high.

what could it be?
 
Just like to point out that this also happens to me at least in the editor game, haven't tried in an actual build or got it to lag that much. When there is lag it basically allows very high jumps.
 
You are executing within the Update loop so it will be framerate dependent. You could switch to FixedUpdate instead. Setting the Force Hold to 0 will prevent additional forces from being added for as long as jump is held down.
 
I had to switch the UCC from fixed update to update or the drive ability will make the car move and the player snap afterwards to the car, which results in a very strong visible camera and character stutter. I am using the latest UCC, ThirdPersonAdventure.drive.gif
Why is the character doing that? I mean the ucc/character gameobject is a child of the car anyway and would move with it without any hassle.
In the GIF both the car controller (from sky car) as well as the UCC Locomotion are using the Fixed Update Location
 
Last edited:
Can you reproduce that camera stutter in the demo scene? It seems fine in the demo scene at my end.
 
So the car in the demo scene uses Unity's standard car controller asset, which updates in Update, not FixedUpdate (not sure what you mean when you said the car controller was using FixedUpdate). So the simplest solution here would be to just use the state system to set the character's update location to Update whilst driving.
 
Is there a reason why the character position is continuously updated while driving? Why is the character not just parented to the vehicle and let the vehicle do all the moving of itself and all its children (including the character)? And how could I deactivate the character movement (while being in the drive state) and keep the animation going of the hands rotating around the steering wheel?
 
So the car in the demo scene uses Unity's standard car controller asset, which updates in Update, not FixedUpdate (not sure what you mean when you said the car controller was using FixedUpdate). So the simplest solution here would be to just use the state system to set the character's update location to Update whilst driving.

This is the CarUserControl.cs from the DemoScene which Moves the SkyCar and it is within the FixedUpdate Loop

Code:
// FROM: Demo/Scripts/Car/CarUserControl.cs

private void FixedUpdate()
{
    // pass the input to the car!
    float h = UnityEngine.Input.GetAxis("Horizontal");
    float v = UnityEngine.Input.GetAxis("Vertical");
    float handbrake = UnityEngine.Input.GetAxis("Jump");
    m_Car.Move(h, v, v, handbrake);
}
 
So CarController.MOVE applies the physics forces to the car, but those physics calculations aren't applied instantly (possibly due to script execution order). This discrepancy is what causes the jitter and why the character's update location should be Update rather than FixedUpdate.

The character does get set as a child of the car transform, but its position still gets set manually. Since you still want to be able to control animations etc whilst in the car, you should either use Update instead of FixedUpdate or force the character's position manually within the Drive ability.
 
Top