Hi, I am using the following code to rotate and move the player
float cameraSmooth = 5.0f;
float modX;
float modZ;
float moveSpeed = 50.0f;
modX = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
modZ = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
modifier.z = modZ;
modifier.x = modX;
transform.position = Vector3.Lerp(transform.position, transform.position + modifier, Time.deltaTime * cameraSmooth);
var inputZ = Input.GetAxis("Vertical");
var inputX = Input.GetAxis("Horizontal");
var angle = Mathf.Atan2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0, angle, 0);
The problem I have is that I need to determine the speed of the object to affect animation speed.
I cant use the joystick axis as it goes from -1 to +1 and I cannot use rigidbody.velocity.magnitude as I am not using forces.
Is there any way I can work out the speed of the object from a scale of 0 to 1?