UpdateFacingDirection









How do I use Update Facing Direction
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: JumpAndRunMovement.cs Copy
22     void Update()
23     {
24         UpdateIsGrounded();
25         UpdateIsRunning();
26         UpdateFacingDirection();
27     }
File name: JumpAndRunMovement.cs Copy
40     void UpdateFacingDirection()
41     {
42         if( m_Body.velocity.x > 0.2f )
43         {
44             transform.localScale = new Vector3( 1, 1, 1 );
45         }
46         else if( m_Body.velocity.x < -0.2f )
47         {
48             transform.localScale = new Vector3( -1, 1, 1 );
49         }
50     }

UpdateFacingDirection 161 lượt xem

Gõ tìm kiếm nhanh...