Skip to content

Instantly share code, notes, and snippets.

@sechiro
Last active April 18, 2026 14:03
Show Gist options
  • Select an option

  • Save sechiro/d5ab003e922dcf9113d4c1b96cda7874 to your computer and use it in GitHub Desktop.

Select an option

Save sechiro/d5ab003e922dcf9113d4c1b96cda7874 to your computer and use it in GitHub Desktop.
VRCPlusDoubleJump
/*
* Double Jump System for VRChat (UdonSharp)
*
* Requirements:
* - VRC SDK 3.10.3 or later
* (Uses VRCPlayerApi.isVRCPlus)
*
* This code is released into the public domain.
* You can use, modify, and distribute it freely without restriction.
* No warranty is provided.
*/
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon.Common;
public class VRCPlusDoubleJump : UdonSharpBehaviour
{
[Header("通常ジャンプ")]
public float normalJumpImpulse = 3f;
[Header("二段目の上向き速度")]
public float doubleJumpVelocity = 3f;
private VRCPlayerApi localPlayer;
private bool canDoubleJump = true;
private bool wasGrounded;
void Start()
{
localPlayer = Networking.LocalPlayer;
if (localPlayer == null) return;
localPlayer.SetJumpImpulse(normalJumpImpulse);
wasGrounded = localPlayer.IsPlayerGrounded();
}
void Update()
{
if (localPlayer == null) return;
bool grounded = localPlayer.IsPlayerGrounded();
if (grounded && !wasGrounded)
{
canDoubleJump = true;
}
wasGrounded = grounded;
}
public override void InputJump(bool value, UdonInputEventArgs args)
{
if (localPlayer == null) return;
if (!value) return; // 押した瞬間だけ
// VRC+ 以外は二段目を禁止
if (!localPlayer.isVRCPlus) return;
// 地上では通常ジャンプに任せる
if (localPlayer.IsPlayerGrounded()) return;
// 1回だけ許可
if (!canDoubleJump) return;
Vector3 vel = localPlayer.GetVelocity();
vel.y = doubleJumpVelocity;
localPlayer.SetVelocity(vel);
canDoubleJump = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment