Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Paper2d MultiDirection floaty movement

I'm currently attempting to make an isometric game, and I have set the movement component to flying, with no gravity. I have designed the proper air braking to give the walking effect a good feel but this works only when its uni-directional input. Once I start a multi-directional input, The movement component ignores braking and starts to "float" giving a drifting effect with the character. Going from UP + LEFT to LEFT causes the component to bank a little bit before course correcting to a full left direction. Same with any other multi-direction to uni-directional/multi-directional movement/direction. I was wondering if you had any suggestions to remove this banking effect currently happening.

 // Configure character movement
     GetCharacterMovement()->DefaultLandMovementMode = MOVE_Flying;
     GetCharacterMovement()->GravityScale = 0.0f;
     GetCharacterMovement()->AirControl = 1600.80f;
     GetCharacterMovement()->bCheatFlying = true;
     GetCharacterMovement()->MaxFlySpeed = 600.0f;
     GetCharacterMovement()->BrakingDecelerationFlying = 500.f;
     GetCharacterMovement()->FallingLateralFriction = 0.f;
     GetCharacterMovement()->GroundFriction = 0.0f;
     GetCharacterMovement()->MaxWalkSpeed = 600.0f; //does nothing
     GetCharacterMovement()->BrakingDecelerationWalking = 3048.f;
     GetCharacterMovement()->JumpZVelocity = 1000.f;
     // Lock character motion onto the XZ plane, so the character can't move in or out of the screen
     GetCharacterMovement()->bConstrainToPlane = true;
     GetCharacterMovement()->SetPlaneConstraintNormal(FVector(0.0f, -1.0f, 0.0f));
     // Behave like a traditional 2D platformer character, with a flat bottom instead of a curved capsule bottom
     // Note: This can cause a little floating when going up inclines; you can choose the tradeoff between better
     // behavior on the edge of a ledge versus inclines by setting this to true or false
     GetCharacterMovement()->bUseFlatBaseForFloorChecks = true;

These are my current movement component settings for C++. I'm trying to get rid of the floaty movement. Any help in this will be greatly appreciated.

Thank You

Product Version: Not Selected
more ▼

asked May 02 '15 at 11:33 PM in C++ Programming

avatar image

95 12 16 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

As Written by Zak Middleton: https://forums.unrealengine.com/showthread.php?3539-Project-Paper2D/page14 (towards the bottom)

you will only want to override CalcVelocity; Friction is used for turning in CalcVelocity with this code:


     // Friction affects our ability to change direction. This is only done for input acceleration, not path following.
     const FVector AccelDir = GetSafeNormalPrecise(Acceleration);
     const float VelSize = Velocity.Size();
     Velocity = Velocity - (Velocity - AccelDir * VelSize) * FMath::Min(DeltaTime * Friction, 1.f);

There is also the fluid friction applied right after that, if bFluid is true.

In your case I would probably override CalcVelocity to set bFluid to false when flying, and use your own friction setting for turning. You could get fancier if you care to only do this when there is acceleration (so you still have fluid friction when braking/coasting to a stop). Something like this:


 void MyMovementComponent::CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration)
         if (IsFlying())
                 bFluid = false;
                 Friction = MyFlyingFriction;
         Super::CalcVelocity(DeltaTime, Friction, bFluid, BrakingDeceleration);
more ▼

answered May 04 '15 at 10:59 PM

avatar image

95 12 16 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question