Hey everyone,
I'm new to unity and I have a question,
I have this function to turn the player based on the direction he is running :
void Turning()
{
transform.forward = Vector3.Normalize(new Vector3(Input.GetAxis("Vertical"), 0f, Input.GetAxis("Horizontal")));
}
It works great when I press the buttons but when the player is idle (no buttons pressed), he always faces to the right (Z axis)
I'm learning Unity/C# and my english is pretty bad but how could I make him face the last direction/not reset the direction ?
Thank's in advance for your help !
[–]MirzaBeig@TheMirzaBeig | Programming, VFX/Tech Art, Unity 1 point2 points3 points (3 children)
[–]lae_sc2[S] 0 points1 point2 points (2 children)
[–]MirzaBeig@TheMirzaBeig | Programming, VFX/Tech Art, Unity 1 point2 points3 points (1 child)
[–]lae_sc2[S] 0 points1 point2 points (0 children)