Skip to content

Instantly share code, notes, and snippets.

@iwacchik
Last active May 27, 2025 16:22
Show Gist options
  • Select an option

  • Save iwacchik/903258cc48bb34a2e4a8e3bd3a862e44 to your computer and use it in GitHub Desktop.

Select an option

Save iwacchik/903258cc48bb34a2e4a8e3bd3a862e44 to your computer and use it in GitHub Desktop.
プレイヤーをRagdoll(ぐにゃぐにゃ状態)にするVRCワールドギミック
using UdonSharp;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
/// <summary>
/// プレイヤーをRagdoll(ぐにゃぐにゃ状態)にするVRCワールドギミック
/// </summary>
public class VRCRagdollSystem : UdonSharpBehaviour
{
// InteractとSetRagdollは別のスクリプトに実装することができます
public override void Interact()
{
// ワールド内全員をRagdollにする
SendCustomNetworkEvent( NetworkEventTarget.All, nameof(SetRagdoll) );
}
public void SetRagdoll()
{
// CombatのHPが0の時にRagdollになる
Networking.LocalPlayer.CombatSetCurrentHitpoints(0);
}
public override void OnPlayerJoined(VRCPlayerApi player)
{
if (!Utilities.IsValid(player))
{
return;
}
// Combatの初期化
// リモートプレイヤーのRagdoll状態を同期させるにはローカルで全員のCombatSetupを実行する必要がある
player.CombatSetup();
// 画面にエフェクト設定
// デフォルト設定があるのでnullで非表示にする
player.CombatSetDamageGraphic( null );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment