Player Mod Setter
This UdonBehaviour example script allows you configure the movement of players in your world.
Variables
Name | Type | Default | Description |
---|---|---|---|
Jump Height | float | 3 | The jump strength of players. Affected by gravity. |
Run Speed | float | 4 | - Keyboard input: The movement speed when moving forward or backward without holding the 'Shift' key. - Analog stick input: The movement speed when tilting the stick forward or backward. |
Walk Speed | float | 2 | - Keyboard input: The movement speed when moving forward or backward without holding the 'Shift' key. - Analog stick input: Always uses "Run Speed" instead of "Walk Speed." |
Strafe Speed | float | 2 | The movement speed when moving left or right. |
Gravity | float | 1 | The amount that gravity affects players. |
Use Legacy Locomotion | bool | false | Enables VRChat's deprecated legacy locomotion system. Cannot be disabled by Udon later. |
Example
The UdonSharp program is called PlayerModSetter.cs
and the Udon Graph program is called VRCWorldSettings.asset
. They work very similarly, and either one can be used in your VRChat world.
- Udon Graph
- UdonSharp
This Graph program can be found in Packages/com.vrchat.worlds/Samples/UdonExampleScene/UdonProgramSources/VRCWorldSettings.asset/
.
This is a simplified example of the UdonSharp script \Assets\UdonSharp\UtilityScripts\PlayerModSetter.cs
.
using UnityEngine;
using VRC.SDKBase;
public class PlayerModSettings : UdonSharpBehaviour
{
VRCPlayerApi playerApi;
[Header("Player Settings")]
[SerializeField] float jumpImpulse = 3;
[SerializeField] float walkSpeed = 2;
[SerializeField] float runSpeed = 4;
[SerializeField] float gravityStrength = 1;
void Start()
{
playerApi = Networking.LocalPlayer;
playerApi.SetJumpImpulse(jumpImpulse);
playerApi.SetWalkSpeed(walkSpeed);
playerApi.SetRunSpeed(runSpeed);
playerApi.SetGravityStrength(gravityStrengh);
}
}