private void SetStrafe() { var newValue = 0f; switch (strafeSpeedChangeType) { case 0: { newValue = strafeSpeed; break; } case 1: { newValue = player.GetStrafeSpeed() + strafeSpeed; break; } case 2: { newValue = Mathf.Clamp(player.GetStrafeSpeed() - strafeSpeed, Mathf.Epsilon, float.MaxValue); break; } } player.SetStrafeSpeed(newValue); }
private bool TestPlayerLocomotionSettings(VRCPlayerApi player) { Debug.Log("TestPlayerLocomotionSettings"); // Teleports Debug.Log("Player TeleportTo"); player.TeleportTo(transform.position, Quaternion.identity); float expected = 200; float val = 0; if (player.isLocal) { // Strafe Debug.Log("Player Strafe: " + player.GetStrafeSpeed()); player.SetStrafeSpeed(expected); val = player.GetStrafeSpeed(); if (val != expected) { Debug.LogError("Strafe speed does not equal expected value!"); return(false); } } if (player.isLocal) { // Walk Debug.Log("Player Walk"); player.SetWalkSpeed(expected); val = player.GetWalkSpeed(); if (val != expected) { Debug.LogError("Walk speed does not equal expected value!"); return(false); } } if (player.isLocal) { // Run Debug.Log("Player Run"); player.SetRunSpeed(expected); val = player.GetRunSpeed(); if (val != expected) { Debug.LogError("Run speed does not equal expected value!"); return(false); } } if (player.isLocal) { // Jump Debug.Log("Player Jump"); player.SetJumpImpulse(expected); val = player.GetJumpImpulse(); if (val != expected) { Debug.LogError("Jump speed does not equal expected value!"); return(false); } } if (player.isLocal) { Debug.Log("Player Gravity"); player.SetGravityStrength(expected); val = player.GetGravityStrength(); if (val != expected) { Debug.LogError("Gravity strength does not equal expected value!"); return(false); } } { Debug.Log("Player Velocity: " + player.GetVelocity()); Vector3 velocityExpected = Vector3.up * 50; player.SetVelocity(velocityExpected); // TODO fix // Vector3 velocityActual = player.GetVelocity(); // if (velocityActual != velocityExpected) // { // Debug.LogError("Player velocity does not equal expected value! " +velocityActual +" " + velocityExpected); // return false; // } } { Debug.Log("Player IsPlayerGrounded: " + player.IsPlayerGrounded()); } return(true); }