I have:
public float moveAngleMin = 5.0f;
public float moveAngleMax = 45.0f;
public float runAngleMin = 355.0f;
public float runAngleMax = 315.0f;
and in the Update function:
void Update() {
// Check rotation of head in X axis
if (vrCamera.eulerAngles.x >= moveAngleMin && vrCamera.eulerAngles.x < moveAngleMax)
{
// Move forward
moveForward = true;
runForward = false;
}
if (vrCamera.eulerAngles.x <= runAngleMin && vrCamera.eulerAngles.x >= runAngleMax)
{
// Run forward
moveForward = false;
runForward = true;
}
else {
// Stop moving
moveForward = false;
runForward = false;
}
}
The fun fact about above "if"s is that they work… for 2nd if - my character is able to run when I move my head up. When moving below 5 - nope he can’t. But after changing the order of this "if"s - he can move but can’t run - I tried else if and other things - can anybody help? I’ll upvote of course good answer.
Thank you in advance!