private void SetRun() { var newValue = 0f; switch (runSpeedChangeType) { case 0: { newValue = runSpeed; break; } case 1: { newValue = player.GetRunSpeed() + runSpeed; break; } case 2: { newValue = Mathf.Clamp(player.GetRunSpeed() - runSpeed, Mathf.Epsilon, float.MaxValue); break; } } player.SetRunSpeed(newValue); }
public void constupdate() { ismaster.text = "ismaster: " + PlayerApiref.isMaster.ToString(); playerid.text = "playerid: " + PlayerApiref.playerId.ToString(); playergrounded.text = "isplayergrounded: " + PlayerApiref.IsPlayerGrounded().ToString(); isowner.text = "isowner: " + PlayerApiref.IsOwner(ownercheck).ToString(); gravitystrength.text = "gravitystrength: " + PlayerApiref.GetGravityStrength().ToString(); if (!changeapi) { runspeed.text = "runspeed: " + PlayerApiref.GetRunSpeed().ToString(); walkspeed.text = "walkspeed: " + PlayerApiref.GetWalkSpeed().ToString(); jumpimpulse.text = "jumpimpulse: " + PlayerApiref.GetJumpImpulse().ToString(); } else { runspeed.text = "runspeed: NULL"; walkspeed.text = "walkspeed: NULL"; jumpimpulse.text = "jumpimpulse: NULL"; } velocity.text = "velocity: " + PlayerApiref.GetVelocity().ToString(); position.text = "position: " + PlayerApiref.GetPosition().ToString(); rotation.text = "rotation: " + PlayerApiref.GetRotation().ToString(); }
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); }