# Using Projectile motion for Jump Arcs

**URL:** <https://forums.unrealengine.com/t/using-projectile-motion-for-jump-arcs/486543>\
**Category:** Character & Animation\
**Tags:** projectile-movement, character-state, unreal-engine, question\
**Created:** [July 23, 2021, 5:01pm UTC](https://forums.unrealengine.com/t/using-projectile-motion-for-jump-arcs/486543 "2021-07-23T17:01:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvarofer0020](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alvarofer0020](https://forums.unrealengine.com/u/alvarofer0020)\
**Post date:** [July 23, 2021, 5:01pm UTC](https://forums.unrealengine.com/t/using-projectile-motion-for-jump-arcs/486543/1 "2021-07-23T17:01:31Z")

</div>

Hello

So im trying to integrate a projectile motion equation for my character jumping mechanics, So jumps and their respective arcs are easier to visualize and tweak, As inspiration from these two videos

[BetterJumpExample](https://www.youtube.com/watch?v=IOe1aGY6hXA)

So far i alredy got a custom character movement component, based off the UCharacterMovementComponent, i have overriden the PhsyFalling state to run my own falling ( and jumping ) logic, however even following the example in the video 1:1 my jumps are not working as they should ( i.e tweaking JumpFall, JumpPeak and JumpHeight ) does not produce a jump that follows these values

MyCharacterMovementComponent.h

```
UCLASS()
class TESTPROJECT_API UMyCharacterMovementComponent : public UCharacterMovementComponent
{
	GENERATED_BODY()
public:

	UPROPERTY(EditAnywhere)
		float JumpHeight = 100;

	UPROPERTY(EditAnywhere)
		float TimeToFall = 0.5;

	UPROPERTY(EditAnywhere)
		float TimeToPeak = 0.4;

	UPROPERTY()
	float JumpVelocity = (2.0 * JumpHeight) / TimeToPeak;

	UPROPERTY()
	float JumpGravity = (-2.0 * JumpHeight) / (TimeToPeak * TimeToPeak);

	UPROPERTY()
	float FallGravity = (-2.0 * JumpHeight) / (TimeToFall * TimeToFall);

	float GetCustomGravity();

	virtual void PhysFalling(float deltaTime, int32 Iterations) override;
}

```

MyCharacterMovementComponent.cpp

```
void UMyCharacterMovementComponent::PhysFalling(float deltaTime, int32 Iterations)
{
        Velocity.Z += GetCustomGravity() * deltaTime;
return;
}

float UMyCharacterMovementComponent::GetCustomGravity()
{
    if (Velocity.Z > 0)
    {
        return JumpGravity;
    }
    else
    {
        return FallGravity;
    }

}

bool UMyCharacterMovementComponent::DoJump(bool bReplayingMoves)
{
    Launch(FVector(0, 0, JumpVelocity));
     //Assigning Z velocity did nothing
    //Velocity.Z = JumpVelocity;
    return true;
}

```

[JumpGDCTalk](https://www.youtube.com/watch?v=hG9SzQxaCm8&t=252s)

With the current implementation, regardless of what values I set JumpHeight, TimeToFall and TimeToPeak to my jumps tend to be mostly very small or short

I could certainly use some help to figure out where things are going wrong, Thanks!
