I want my wall jump to always send my character up and away from the wall a set amount, but maintain my velocity along the wall (parallel). This has the desired effect other than my velocity towards the wall fights against the launch away from the wall. I’m sure I need to use set velocity instead but I can’t figure out how to get the desired X and Y values no matter which way the wall is facing/im moving.
Whoa. That’s some fancy way of getting an array element.
There are several approaches, but with your code the simplest way would be to tick OverrideXY and make sure to include the wall-parallel portion of player velocity into the launch velocity.
In code terms it would look like this :
FVector Vel = CharacterMovement->GetVelocity();
FVector ParallelVel = ProjectVectorOnToPlane(Vel, HitNormal);
FVector LaunchVelocity = ParallelVel + 300*HitNormal + FVector(0,0, CharacterMovement->JumpZVelocity * 1.4);
LaunchCharacter(LaunchVelocity, true, true);
Note that parallel velocity may contain a Z portion, rendering walljump less consistent. You might want to zero out ParallelVel.Z if that is not desired. Also in case of slanted walls, HitNormal will contain a Z portion that may want to zero out (if you do, make sure to normalize it again, or simply use HitNormal = HitNormal.GetSafeNormal2D())
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.