-
-
Notifications
You must be signed in to change notification settings - Fork 122
Home
Dawnosaur edited this page Jul 26, 2023
·
22 revisions
- What is my platformer movement for?
- Why should you use it?
- Why shouldn't you use it?
float targetSpeed = _moveInput.x * Data.runMaxSpeed;
float speedDif = targetSpeed - RB.velocity.x;
float movement = speedDif * accelRate;
RB.AddForce(movement * Vector2.right, ForceMode2D.Force);
#region LAYERS & TAGS
[Header("Layers & Tags")]
[SerializeField] private LayerMask _groundLayer;
#endregion
private void Awake()
{
RB = GetComponent<Rigidbody2D>();
AnimHandler = GetComponent<PlayerAnimator>();
}