2.5D Training Progression Report: Movement and Moving Platforms. Unity

Today I follow up on the last progression repot to show what progress have I made so far.

What has been accomplished so far?!

For this prototype, we decided to use the character controller in order to control the movement and physics interactions of the player.

Horizontal movement and Jumping

To control the horizontal movement, I assigned a variable to detect the player’s input along the x-axis. This variable will be assigned to the direction and velocity used for the character controller Move() method.
As for jumping, as long as the player grounded, he can jump once. Once the player jumped, we reset his velocity on the y-axis (to remove any gravity from the last frame) and then add the jump height. This allows for a smoother and more consistent jumping.

Double Jumping

Basically this is almost like jumping, but it is done when the player is not grounded. By using a Boolean we control when and how often the player can double jump.

Double Jump

Wall Jumping

This is a little more complicated. Depending on the very handy method that comes with the character controller (OnControllerColliderHit), we detect when the player collides with a wall(tagged wall). This detection will assign a Vector3 normal based on the hit.normal of the collided surface and allow the player to wall jump.

if (Input.GetKeyDown(KeyCode.Space) && !_canWallJump)
if (_canDoubleJump)
_yVelocity = 0;
_yVelocity += _jumpHeight;
_canDoubleJump = false;
Wall Jump

Moving Platform

I created a modular moving platform system where it take two or more waypoints and moves the platform from one point to another using the Vector3.MoveTowards method in the FixedUpdate for a smoother movement.

Moving Platform

Next up, elevators and push systems.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohamed Hijazi

Mohamed Hijazi

A knowledge seeking biologist who is following his passion into a full time career in Unity / Game Development. https://www.linkedin.com/in/mohamed-hijazi/