restrict avatar body yaw to be between 0-360

This commit is contained in:
Philip Rosedale 2013-05-15 08:06:53 -07:00
parent 5fec8bc8fe
commit daaf86a634
2 changed files with 5 additions and 0 deletions

View file

@ -303,6 +303,7 @@ void Avatar::updateFromMouse(int mouseX, int mouseY, int screenWidth, int scree
((mouseLocationX > 0.f) ? ((mouseLocationX > 0.f) ?
mouseMag : mouseMag :
-mouseMag) ); -mouseMag) );
printLog("yaw = %f\n", getBodyYaw());
} }
return; return;

View file

@ -217,7 +217,11 @@ float AvatarData::getBodyYaw() {
} }
void AvatarData::setBodyYaw(float bodyYaw) { void AvatarData::setBodyYaw(float bodyYaw) {
if ((bodyYaw > 360.f) || (bodyYaw < 0.f)) {
bodyYaw -= floorf(bodyYaw / 360.f) * 360.f;
}
_bodyYaw = bodyYaw; _bodyYaw = bodyYaw;
} }
float AvatarData::getBodyPitch() { float AvatarData::getBodyPitch() {