To showcase the climbing feature, multiple objects (terrains) including walls, pillar, ceiling, ramps are placed to test if the player can behave correctly when facing climbable/non-climbable objects.
Also, a Dummy character is placed inside the level that reacts to attack.
- Run: press
W A S D
to make the player run in different directions. - Jump: press
Space Bar
to start a jump. - Climb: press
E
to try climbing. If there is a climbable surface in front of the player, he will climb. - Cancel Climb: press
Q
to stop climbing. - Attack: press
Left Mouse Button
to attack. The player will not be able to run, jump, or climb during attack.
- The player should not be able to jump while attacking.
- The player should not freely move while attacking.
- The above are implemented by setting
isAttacking = true
inside Player's blueprint. Inside C++ action callback functions such asAGoeaTechEvalCharacter::MoveForward()
, actions are blocked by conditionif(IsAttacking)
.
- The above are implemented by setting
- The player should not be able to attack when climbing.
- Spamming the attack does not cancel itself.
- This is done my wrapping a
Do once
node around attack logics. It will be reset after attack montage has completed playing.
- This is done my wrapping a
- Feedbacks while attacking:
- Plays Sword_whoosh sfx when whipping the sword.
- Plays Impact_sword_to_body sfx when Dummy is attacked.
- Applied Camera Shake when Dummy is attacked.
- Dummy plays On Damage montage when attacked and steps back due to root motion.
The climbing feature is created completely in C++ inside my UCustomCharacterMovementComponent
that inherits the CharacterMovementComponent
class.
- Detecting surfaces: Use shape sweep on every tick to detect collisions in front of the player.
CanStartClimbing()
: Check if the collision(s) in front of the player is a climbable surface. Criterias for climbable surfaces are described below.PhysClimbing()
: Handles climbing velocity, acceleration, movement, and collsion.ComputeSurfaceInfo()
: CalculatesCurrentClimbingNormal
andCurrentClimbingPosition
by averaging all colliding surfaces normals and hit positions.ShouldStopClimbing
: Checks if (player cancels climb event) || (no climbable surface) || (player is on ceiling/floor).ComputeClimbingVelocity()
: Calculates velocity by callingCalcVelocity()
from base class if not controlled by root motion.MoveAlongClimbingSurface()
: Move the character by callingSafeMoveUpdatedComponent()
and make the player look towards the surface normal.SnapToClimbingSurface()
: Move the character towards the surface.
Climbable criterias:
- Player should be looking at a maximum
MaxHorizontalDegreesToStartClimbing = 30.f
degrees in order to climb the surface. - Player should not be able to climb on ceilings or floors (i.e., surface normal is nearly same direction as world up-direction.)
- Player should not be able to climb objects that are lower than it's eye height. Calls
IsFacingSurface()
to line-trace forward at eye height to check if hitting the object. - Player should not be able to climb on other characters.
Red objects and character are unclimbable.
- Climbing animations using Blendspace
- Added sound effects for running, attacking, and climbing.
- Dummy character always faces player when distance between them
<= 500
. (Implemented inside Blueprint) - Dummy character plays attacked montage and steps back due to root motion. (Implemented inside Blueprint)
-
Dummy sometimes teleports when attacked
-
Compile error when project packaging. Error messages shows that the issue are related to my
CustomCharacterMovementComponent
. -
Player cannot move after Unreal crashes or other random events.
- This issue can be fixed by recreating a new player blurprint and replicating every component and settings. However, it appeared multiple times and it is time consuming to recreate and reset the character everytime.
- Add more climbing assets for smooth ground-to-wall/wall-to-ground/wall-to-wall transition.
- Detect when to climb up ledges/roof and use root motion to move itself up.
- Weapon/footstep sfx are hardcoded in animation assets. Should be able to consider material of collided object to play different sfx.