hello everyone, im making a 2.5D game where the player moves right and left only and hes a 3D object (rigidbody3D)…
i have this ode implemented for movement:
_HorizontalAxis = Input.GetAxis("Horizontal");
//Takes Only Direction of movement
Vector3 _moveHorizontal = transform.right * _HorizontalAxis;
Debug.Log(_HorizontalAxis);
// Final Movement Vector (Multiply Direction with Speed)
Vector3 _velocity = (_moveHorizontal).normalized * movementSpeed;
motor.Move(_velocity);
// Flipping the Player Left and Right
if (_HorizontalAxis > 0 && !facingRight)
{
//flip the player.
motor.fFlip();
}
// Otherwise if the input is moving the player left and the player is facing right...
else if (_HorizontalAxis < 0 && facingRight)
{
//flip the player.
motor.fFlip();
}
will the thing is when i move right OR left the object just moves right all the time …
i know im missing something somewhere it’s just my brain is teased >,<
this is my Fliping function:
public void fFlip()
{
// Flip the character
if (!playerController.facingRight)
transform.eulerAngles = new Vector3(0, 0, 0);
else
transform.eulerAngles = new Vector3(0, 180, 0);
// Switch the way the player is labelled as facing.
playerController.facingRight = !playerController.facingRight;
}
I really appreciate your help and heads up for me to see the missing part >,>
Thanks,
HeroO