ok, been trying to wrap my brain around this for a while, and I’m still stuck.
I’ve got a gear that’s being rotated to follow the mouse cursor with this code:
Vector3 targetPoint = new Vector3(myTarget.transform.position.x, transform.position.y, myTarget.transform.position.z);
// Determine the target rotation. This is the rotation if the transform looks at the target point.
Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
// Smoothly rotate towards the target point.
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, speed * Time.deltaTime);
I also need to calculate the RPM while the player is rotating the gear. (it could change at any given time, since the player is rotating the gear)
Math is not my strong point. anyone have any suggestions on how to calculate RPM?
Yup. But remember your ticks are a fraction of a second, so you will need that same fraction of 6 degrees. You might want to grab the total rotation on a fixed schedule and do some fine tuning, but that should get you started.