Scale current lateral velocity by input direction when jumping (not working)
This commit is contained in:
parent
c9fb74b90d
commit
88cbe5910c
BIN
SwordNGun/Content/Characters/Protagonist/BP_NewProtag.uasset
(Stored with Git LFS)
BIN
SwordNGun/Content/Characters/Protagonist/BP_NewProtag.uasset
(Stored with Git LFS)
Binary file not shown.
@ -208,7 +208,8 @@ bool USNGCharacterMovementComponent::DoJump(bool bReplayingMoves)
|
||||
FLaunchParameters JumpParams;
|
||||
|
||||
FVector WorldInputDir = CharacterOwnerAsSNGChar->GetInputAsWorldDirection();
|
||||
if(WorldInputDir.Size2D() >= CharacterOwnerAsSNGChar->GetInputThreshold())
|
||||
bool InputThresholdMet = WorldInputDir.Size2D() >= CharacterOwnerAsSNGChar->GetInputThreshold();
|
||||
if(InputThresholdMet)
|
||||
{
|
||||
FVector JumpLateralVelocity = WorldInputDir * DefaultJumpLateralVelocity;
|
||||
JumpParams.Velocity.X = JumpLateralVelocity.X;
|
||||
@ -221,7 +222,13 @@ bool USNGCharacterMovementComponent::DoJump(bool bReplayingMoves)
|
||||
JumpParams.bOverrideY = false;
|
||||
JumpParams.bOverrideZ = true;
|
||||
|
||||
JumpParams.VelocityScale = FVector(LateralVelocityScaling, 1.0f);
|
||||
/**
|
||||
* NOTE(kevin): This is done so that if the player holds nothing the character still carries some lateral
|
||||
* momentum out of a neutral jump. If the player if moving forward but jumps right (this is all relative
|
||||
* to the camera) we want all forward momentum canceled and the character to only have velocity going
|
||||
* up and right.
|
||||
*/
|
||||
JumpParams.VelocityScale = FVector(InputThresholdMet ? FVector2D(WorldInputDir.X, WorldInputDir.Y) * LateralVelocityScaling : LateralVelocityScaling, 1.0f);
|
||||
|
||||
JumpParams.bUseDefaultGroundFriction = true;
|
||||
JumpParams.bUseDefaultGravityScale = true;
|
||||
|
Loading…
Reference in New Issue
Block a user