Download

Z velocity of Pawn is 0?

I have a setup in which the character can alter its mode of movement. At some point i try to read out the velocity of the character (Capsule) and was surprised to find that only X and Y velocities are non-zero. the Z velocity is always 0? I guess this has to do with the setup of the CharacterMovement, but i do need this Z velocity, does anybody know what property encodes this Z velocity?

Thanks a million!

Z is up in UE4. Unless your character is jumping or falling (or you manually apply gravity), I would expect a 0 velocity for Z.

Any of this apply: A. The altered-mode-of-movement is done with interpolation (BP-circuits with fInterp / AddActorWorldOffset / SetActorLocation)… That will produce ZERO Velocity, even if the effect looks close to physics movement. B. The character-capsule is Rotated on its side, so while visually it may be moving up, its really moving to the side ‘relatively’ speaking…

Let me simplify the question: How do i read out the Z-velocity of my pawn if it is moving up-hill whilst not jumping or falling? Somewhere in the engine a delta-z must be applied to alter the location of the pawn to make it follow the surface of the landscape, where do i find this value? Thank you!

It’s in the UCharacterMovementComponent. Search the code for “GravityScale” and you’ll find it.