A movement system made in Unity that attempts to replicate Genshin Impact Movement.
A movement system made in Unity that attempts to replicate Genshin Impact Movement.
An attempt on replicating 3 (Moving, Gliding, Swimming) Genshin Impact Movement Systems.
-%23FF0000.svg?style=for-the-badge&logo=YouTube&logoColor=white)
Provided Animations were downloaded from Mixamo.
Map Materials were downloaded from Kenneys Assets.
[field: SerializeField] attribute, Unity 2020+ is required. 2020.3 LTS was used for this project.Player Scriptable Object and set the desired settings.Resizable Capsule Collider Component for you to add to any Game Object you want to resize your collider from the bottom only to be able to use the Floating Capsule technique. It should throw an error once when you first add it as a Component due to the OnValidate method likely being called before Unity serializes the data classes, but it should work fine. You can always initialize the [Serializable] classes in the Initialize method if you don't want that error showing.Unveil me!
Released code is only up to date to my last released Tutorial Series video.
To get an idea on what the Tutorial Series will end up providing, please refer to This Video.
The main goal of the Series is to teach game developers (mostly beginners) on how can they achieve something similar to Genshin Impact Movement System.
Here's the list of techniques used to make this System possible:
Pro Builder
A Small Test Map was created for this Project.
New Input System
The Old Input System was disabled for this Project.
Version 1.3.0
Cinemachine
A Virtual Camera was used to achieve the same or close to the same result as Genshin Camera.
Version 2.8.4*
State Machines
Hierarchy State Machines were used at their simplest implementation (State Inheritance).
Floating Capsule
Allows Resizing the Capsule Collider without the Player falling due to Gravity.
Makes it possible to climb steps and slopes.
Physics-Based Movement
A Rigidbody was used for all the Player Movement.
No Built-In Character Controller was used.
Animations
Reusable Sub-State Machines were used for the Animations.
No Blend Trees were used.
*As of this version, there's a bug that doesn't allow disabling the Cinemachine Input Provider actions, which could be used for disabling the Camera Rotation or the Camera Zoom. It should be fixed in future versions.
A Small Test Map was created in hopes of being able to test all features this System will provide.
Uses Kenneys Prototype Textures as the Map Materials.
The use of Unity New Input System allows the addition of callbacks whenever a key was pressed, changed or unpressed.
These translate to the actions of started, performed and canceled.
Features like only considering the key being pressed after an amount of time has passed is also easily achieved by using an Interaction.
The Camera also uses the New Input System.
The Project does not provide a Control Scheme and only provides you with Keyboard Inputs.
The plan is to develop and release 3 Genshin Impact Movement Systems. Means the System has been fully released on both Youtube and Github. Means the System has been fully developed but is awaiting release on both Youtube and / or Github or awaiting for another System release. Means the System is still in Development or requires something to be Fixed before it can be released.
The Player Camera imitates Genshin Impact Camera using Unity Cinemachine Package.
This is very likely what Genshin uses as well.
All 3 Systems have different settings for the Camera but it mostly works the same way.
The Camera offers an Orbital Rotation around the Player.
Click here for longer video (47MB)
We can Zoom In and Zoom Out using the Mouse Scroll Wheel.
Click here for longer video (83.6MB)
It also offers different Rotations at different angles or movement directions.
For example, moving the Player to the sides slowly rotates the Camera, which in itself rotates the Player, as the Player Rotation is relative to the Camera.
Click here for longer video (31.7MB)
When looking from the Top or Bottom, it also rotates faster, which makes the Player move in a small circular motion (much like in Genshin).
Click here for longer video (120MB)
There are several possible rotation outcomes, all of which I speak of in my Tutorial Series Video about Camera Recentering.
The main logic of the Player Movement follows the State Machines Pattern.
I've decided to cache the existing States instead of instantiating new ones.
Therefore, changing to another State can be done through a similar code line: stateMachine.ChangeState(stateMachine.IdlingState).
Click here for longer video (42MB)
To prevent the Player from getting stuck on steps as well as to prevent the Player from jumping on slopes, a force is constantly added to the Player to keep it afloat.
A resizable capsule collider feature is provided, which is considered the same as the maximum climbable step height.
The size is only removed from the bottom.
To prevent the Player from falling due to Gravity when its collider is resized, a Ray is cast downwards and a (positive or negative) force is added to the Player depending on the distance from the collider center to the ground.
This allows the Player to keep itself at a constant height both when moving on slopes or when trying to climb steps.
Click here for longer video (55.2MB)
The idea was taken From This Video.
A Rigidbody is used for the Character Movement, meaning that it moves using built-in Physics.
The Ground Movement offers Walking, Running, Dashing, Sprinting, Landing and Stopping States as well as a way to swap between Walking and Running at the press of a Button.
There's also Jumping and Falling.
Click here for longer video (95.5MB)
The Player also moves slower depending on the Slope / Ground Angle (An Animation Curve is used to set the Angles and Speeds).
Click here for longer video (41.2MB)
The System also offers the transition between Sprinting to Running and Walking when the Sprint key wasn't held long enough to keep performing it.
The Player rotates relative to the Camera and the Movement Input.
Click here for longer video (27.3MB)
Much like in Genshin, it offers an Automatic Rotation in certain situations.
For example, fast pressing (pressing and releasing right away) a movement key will keep rotating the Player until it's looking towards the desired movement direction.
Click here for longer video (39.1MB)
The Player can dash up to 2 times (updatable) in less than 1 second (updatable).
If the Player dashes too fast, it will enter a Cooldown (updatable) and the Player will only be able to dash again after that cooldown ends.
[Click here for longer video (50.7MB)](https://imgur.com/Z3j
No open issues yet, or sync has not completed.