UpdateMovement









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

Featured Snippets


File name: JumpAndRunMovement.cs Copy
29     void FixedUpdate()
30     {
31         if( m_PhotonView.isMine == false )
32         {
33             return;
34         }
35
36         UpdateMovement();
37         UpdateJumping();
38     }
File name: JumpAndRunMovement.cs Copy
68     void UpdateMovement()
69     {
70         Vector2 movementVelocity = m_Body.velocity;
71
72         if( Input.GetAxisRaw( "Horizontal" ) > 0.5f )
73         {
74             movementVelocity.x = Speed;
75
76         }
77         else if( Input.GetAxisRaw( "Horizontal" ) < -0.5f )
78         {
79             movementVelocity.x = -Speed;
80         }
81         else
82         {
83             movementVelocity.x = 0;
84         }
85
86         m_Body.velocity = movementVelocity;
87     }

UpdateMovement 137 lượt xem

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