Key Points
-Making a DJ App
-Need to alter
-Maths is hard
public float SliderValue() {
if (isPitch) {
float distAlongForward = Vector3.Dot(transform.position - originalPosition, -transform.forward);
distAlongForward /= m_pitchRange;
return distAlongForward;
}
else {
float distAlongForward = Vector3.Dot(transform.position - originalPosition, -transform.right);
distAlongForward /= m_range;
return distAlongForward;
}
}
-
So I presumed I use transform.forward as to measure against the Z axis as the slider goes towards and away from the user (who is pulling and pushing using leap motion).
-
If that is correct, what exactly should the range relevant to in order to make this a manageable number.
-
I then need this number to affect the pitch (i.e. convert this output number into a number between 0.5 (half speed) and 2 (double speed) to alter the pitch.
In Summary: Output number from DOT function → range that outputs nicer number? → convert so if more than 0 multiply towards 2 and if less than 0 multiply towards 0.5.
If anything is not explained well please ask as this is University urgent