# Player Input and Pawns On Your Own section help

**URL:** <https://forums.unrealengine.com/t/player-input-and-pawns-on-your-own-section-help/465381>\
**Category:** Character & Animation\
**Tags:** unreal-engine, CPP, question, key-bind\
**Created:** [May 31, 2020, 12:47am UTC](https://forums.unrealengine.com/t/player-input-and-pawns-on-your-own-section-help/465381 "2020-05-31T00:47:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SageWizard88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SageWizard88](https://forums.unrealengine.com/u/SageWizard88)\
**Post date:** [May 31, 2020, 12:47am UTC](https://forums.unrealengine.com/t/player-input-and-pawns-on-your-own-section-help/465381/1 "2020-05-31T00:47:55Z")

</div>

I was following the [Player Input and Pawns](https://docs.unrealengine.com/en-US/Programming/Tutorials/PlayerInput/index.html) tutorial on the documentation. So, in the ‘On Your Own’ section, there was a challenge that if the player was moving, and he pressed Spacebar then the cube would instantly become double the size.

I decided to do it by making a boolean true if the movement keys were pressed. Apparently, there are no Axis Mapping Pressed functions so I had to make duplicate Action Mappings. What would be a better way?

I also wanted to implement that the speed of the object would increase the longer the key was pressed. I am doing it like this -

```
TimeXW = PController->GetInputKeyTimeDown(EKeys::W);
TimeXS = PController->GetInputKeyTimeDown(EKeys::S);

if (TimeXW != 0.0f)
{
   CurrentVelocity.X = FMath::Clamp(AxisValue, -1.0f, 1.0f) * 100.0f * TimeXW;
		TimeXW = 0.0f;
}
else if (TimeXS != 0.0f)
{
        CurrentVelocity.X = FMath::Clamp(AxisValue, -1.0f, 1.0f) * 100.0f * TimeXS;
	TimeXS = 0.0f;
}

```

Is there a better way? Also, what does the word ‘EKeys’ in GetInputKeyTimeDown mean?

When I added this acceleration-time stuff, the object would continue moving even when I released the key. Why is this happening now but not before?  
I fixed it by setting the CurrentVelocity to zero every tick after setting the new location. No idea why I had to do this now.

```
if (!CurrentVelocity.IsZero()) 
{
	FVector NewLocation = GetActorLocation() + (CurrentVelocity * DeltaTime);
			SetActorLocation(NewLocation);
			CurrentVelocity.X = 0.0f;
			CurrentVelocity.Y = 0.0f;
}

```

Thanks In advance!
