For some reason my character controller jump code seems to be frame based :(
Basically i have a float for verticalSpeed (velocity if you will) When the user presses jump i call this function to set the speed
public void Jump(float height) {
didJump = true;
Swimming = false;
verticalSpeed = Mathf.Sqrt(2.0f * height * Gravity) * -1.0f;
}
With my current code verticalSpeed will always be -8.944272
Then in update i have the following:
verticalSpeed += Gravity * deltaTime;
if (verticalSpeed < -13.0f) verticalSpeed = -13.0f;
else if (verticalSpeed > 20.0f) verticalSpeed = 20.0f;
CachedController.Move(((verticalSpeed * gravityDirection) * deltaTime));
Now the issue is running at 20 frames my jump isn't half as high as running at say 140 frames.
If interested here are my other variables: gravityDirection = Vector3 (0.0f, -1.0f, 0.0f) Gravity = float (20.0f) height for jump function = float (2.0f)
Nothing else moves my character except for this code.