0
Fixed

Character 'Max Fall speed' works incorrect if the character gravity is > 0

mirec313 4 months ago in Game Creator updated by Marti (Lead Developer) 3 months ago 2

Hi, I'm trying swimming tutorial

https://www.youtube.com/watch?v=s3c-x3V5PpI&t=168s

with a modification - when I press a button (space) then player gravity will set to a +9.81 and max fall speed to a +2

But then a character is moving upwards much faster than when he moving downwards with gravity -9.81 and max fall speed -2

It seems the problem is that max fall speed in not applied correctly if gravity is > 0

There is check in the file CharacterLocomotion.cs at the end of function 'UpdateVerticalSpeed' which does not works for positive values:


this.verticalSpeed = Mathf.Max(this.verticalSpeed, this.maxFallSpeed);

Also there is another small problem:

If the gravity is negative (-9.81) and the max fall speed is positive (+100), character is moving upwards although the gravity is negative.

I fixed both problems - replacing test with: 


if (this.gravity <= 0)
     this.verticalSpeed = Mathf.Max(this.verticalSpeed, -Mathf.Abs(this.maxFallSpeed));
else
     this.verticalSpeed = Mathf.Min(this.verticalSpeed, Mathf.Abs(this.maxFallSpeed));




Unity version:
2019.3.10f1
Game Creator version:
1.1.8
Under review

Yeah, the fall speed should probably be clamped by magnitude. I'm opening a ticket to assess this. Thanks!

Fixed

This issue has been addressed and will come with the next release. I'm closing the ticket, but if you experience any issues after the update, feel free to write them below. Cheers!