this movement.cover
direc = new Vector3(horizontal, 0, 0).normalized;
direc = transform.TransformDirection(direc);
ch.Move(direc* Time.deltaTime * speed);
anim.SetFloat("Horizontal", horizontal);
this is my move code only in x axis but also increase or decrease in z axis–z should stay constant
debug.log(direc); ======>(1.0,0,0.1) gets an error because of the value at the end(0.1)
(1.0,0,0.4)
this movement.directional,Could it be because of the turn here?
float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref tpain, rpain);
moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
ch.Move(moveDir * speed *Time.deltaTime);