ShootingBattleVRC by K1911jp

[World Image]

In this world, you can do shooting battle.
Collision detection and damage management are finely controlled by UDON.
So, you will fell none stress. Please try it !

[World Link]

  • I will publish to Community Labs at December 18, 2020 Japan time 0:00

There are several game modes and weapons. Please see videos :slight_smile:



Thank you!


And, this is core code of damage gimic.
There are 3 parts.

  • Weapon - Pistol have this. When pull the trigger, send network messeage of fire.And, Owner check if it hits PlayerInformationUI using raycast. If it hits PlayerInformationUI, it will notify the damage.
  • PlayerInformationUI - This is collider of player. Following every player registerd.
  • PlayerBelt - This is counter of HP. There is only one object locally.


    public override void OnPickupUseDown() {
        /* Fire Messeage*/
        SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldFire));

    public void WorldFire() {
        /* Hit check using Raycast */
        if (Physics.Raycast(new Ray(muzzleTran.position, muzzleTran.forward), out hit, rayDistance, layerMask)) {
            tmpPlayerInformationUI = hit.transform.gameObject.GetComponentInParent();
            /* Send damage to PlayerInformationUI (when Owner) */
            if (tmpPlayerInformationUI != null && Networking.IsOwner(Networking.LocalPlayer, gameObject)) {
        /* Sound,Animation */


    public void OnDamage(float damageVal) {
        if (damageVal >= 100) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage100));
        } else if (damageVal >= 90) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage90));
        } else if (damageVal >= 80) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage80));
        } else if (damageVal >= 70) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage70));
        } else if (damageVal >= 60) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage60));
        } else if (damageVal >= 50) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage50));
        } else if (damageVal >= 40) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage40));
        } else if (damageVal >= 30) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage30));
        } else if (damageVal >= 20) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage20));
        } else if (damageVal >= 10) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage10));
        } else if (damageVal >= 0) {
            SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(WorldDamage0));
        public void WorldDamage0() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(0.0F); }
    public void WorldDamage10() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(10.0F); }
    public void WorldDamage20() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(20.0F); }
    public void WorldDamage30() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(30.0F); }
    public void WorldDamage40() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(40.0F); }
    public void WorldDamage50() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(50.0F); }
    public void WorldDamage60() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(60.0F); }
    public void WorldDamage70() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(70.0F); }
    public void WorldDamage80() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(80.0F); }
    public void WorldDamage90() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(90.0F); }
    public void WorldDamage100() {MakeVFX(); if (playerInformation.PlayerId == Networking.LocalPlayer.playerId) playerInformation.PlayerBelt.OnDamage(100.0F); }

    public void OnDamage(float damageVal) {
        PlayerHp -= damageVal;
        if (PlayerHp <= 0) { PlayerDead(); }

Me and my friend came across this world the other day. We spent the better part of an hour in there. It was pretty fun!!

1 Like

Open Beta of new series is started!

Hey thats pretty cool :slight_smile:
Gonna check it out next time I go online.

I’m working on a little shooter segment in my World aswell.

I’ve got a little optimization tip for you tho :slight_smile:
Instead of going for if / else statements you could use switches.

switch (damage)
case 10:
case 20:
case 30:
// and so on

This is easier to read if you go back to the script and it saves on performance.

As far as I understand it with else/if statements unity will check all the statements until it reaches the one statement thats true, instead of just picking the one that is true with switches.

It probably wont improve much on performance in this case because there aren’t too many cases, but it’s good to get into the habit of using switches if you can :slight_smile:

Also: You could just use the int / float as the amount of damage thats dealt to the player, so you dont need multiple Events :slight_smile:

So: .OnDamage(damageVal);

Edit: On second thought: you could probably just send an event that just deals the damageVal, no need for checking the value its gonna deal, if its just gonna deal the set value ^^

But I’m getting to deep into this ^^’

It’s great you’re getting into this, keep going :smiley:

1 Like

Thank you for your reply and advice!
I will continue to do my best ! :laughing:

SeasideTown joins beta release!
We also updated Kingdom, BlackHawk, Warehouse!
Password is no longer required!

Release " Shooting Academy " it’s shooting battle training facility ǃ

・Shooting Runner (2021/8/20 ~)

・Shooting Range (2021/8/28 ~)