Advertisement
gameDevTeacher

Normalized Movement

Sep 2nd, 2021
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1.  if (m_Input.moveVector.magnitude > 1)                            
  2.  {                                                                
  3.      m_Input.moveVector = m_Input.moveVector.normalized;          
  4.  }                                                                
  5.  m_RigidBody2D.velocity = m_Input.moveVector * moveSpeed;          
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement