hardx blog

Free resources coming to MP

Hey, I submitted to the marketplace two plugins.
As a result, they are available to download for free.
HEX Blocks BP vs CPP – something for the new comers to learn parallely blueprints and code.
Directional gravity plugin – planet gravity for your game!


Directional gravity

Free project and plugin download link on the bottom

In the following article you will find out how to override gravity from default Unreal Engine 4 Character. After this change it will be possible any time in the game define gravity vector so character uses it instead of original behavior.

Default Unreal Engine 4 gravity has no directional vector. Gravity points always towards ground FVector = (0,0,-1). Component responsible for updating character in World is CharacterMovementComponent which is attached to the Character. To change default class object Super call from constructor can be used:

AGravityCharacter::AGravityCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass(

To custom your own directional gravity necessary is to override bunch of virtual UCharacterMovementComponent methods:

Public methods:

  • FVector CalcAnimRootMotionVelocity
  • void StartFalling
  • void PhysFalling
  • FVector GetFallingLateralAcceleration
  • FVector NewFallVelocity
  • void UpdateBasedMovement
  • bool DoJump
  • FVector GetImpartedMovementBaseVelocity
  • void JumpOff
  • void FindFloor
  • void UpdateBasedRotation
  • bool FloorSweepTest
  • bool IsValidLandingSpot
  • bool ShouldCheckForValidLandingSpot
  • bool ShouldComputePerchResult
  • bool ComputePerchResult
  • bool CanStepUp
  • bool StepUp
  • void SetMovementMode
  • void SetDefaultMovementMode
  • void AdjustFloorHeight
  • bool CheckLedgeDirection
  • FVector GetLedgeMove
  • void StartNewPhysics
  • void CalcVelocity
  • void ApplyAccumulatedForces
  • bool IsWalkable
  • void ComputeFloorDist
  • bool IsWithinEdgeTolerance

Protected methods:

  • void PhysFlying
  • float BoostAirControl
  • void OnMovementModeChanged
  • void PerformMovement
  • void HandleImpact
  • void ProcessLanded
  • void MaintainHorizontalGroundVelocity
  • float SlideAlongSurface
  • void SetPostLandedPhysics
  • void PhysWalking
  • FVector ComputeGroundMovementDelta
  • void MoveAlongFloor
  • void SimulateMovement
  • FVector ConstrainInputAcceleration
  • FVector ScaleInputAcceleration

As you can see there are quite few methods which needs to be implemented according to implement directional gravity which works well with newly custom gravity vector. I will do walk through all methods in the second part but for now I just explain how plugin works so you can download it and try on your own!

Starting point for analyse is StartNewPhysics() because our movement is physic based. It always needs to update it before performing movement. You can check that every frame it is updated with new PhysMode. Depends on circumstances character may walk, fly, swim, fall etc.

Available movement phys modes:

  • MOVE_Walking – PhysWalking
  • MOVE_NavWalking – PhysNavWalking
  • MOVE_Falling – PhysFalling
  • MOVE_Flying – PhysFlying
  • MOVE_Swimming – PhysSwimming
  • MOVE_Custom – PhysCustom

which are resolved by one on function with similar name. So for example starting new physics with mode MOVE_Walking is resolved by PhysWalking function.
It calculates new velocity and performs walking movement.

Simple blueprint methods:

To make life easier some setting methods were expose to blueprints like

  • GetGravityDirection()
  • SetGravityDirection()

which can be used to compute and update gravity direction for characters.

Free project and plugin:

In the free project below you can find different examples showing how gravity works and how affects not only our Pawn but also StaticGravityCharacter (Cows, boxes).

Planet gravity example
Planet gravity example

The map shows how planet gravity works.

Custom gravity example
Custom gravity example

The map shows simple gravity vector changes, rapid navigation changes.


Simple and practival even if it requires overriding several methods from CharacterMovementComponent.

Free Directional Gravity Project

Directional gravity

Free plugin and project containing custom directional gravity for characters in Unreal Engine 4. Start creating Worlds from unique perspective now!

Project shows simple and more advanced directional gravitations. Traveling from planet to planet and dynamically gravity changes.

Plugin is seperated from rest of the project so it makes portable and can be easily intergrated with other projects!

Free download

smutty ass drilling with sextoy.redtube