Quellcode durchsuchen

Fix JumpPad multiplayer crash, fixer jitter, fizzler default layer

- JumpPad: only the local player gets launched. Remote players used to
  hit GetRunSpeed(), which throws for remote players and halted the pad
  (leaving a mid-jump local player stuck at the limited speeds). Remote
  players still trigger the launch animation.
- PickupMovementFixer: measure the target's movement in LateUpdate so
  the velocity matches the frame the target was moved in. Pickup speed
  on a 1 m/s platform went from 0.55-1.98 m/s to a steady 1.00.
- PickupFizzler: default pickupLayer to 13 (Pickup) instead of 9
  (Player), so it works without changing the layer by hand.

Bump version to 1.0.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ArtyomV2X vor 6 Stunden
Ursprung
Commit
f3eaa396e2
4 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen
  1. 10 0
      Runtime/JumpPad.cs
  2. 1 1
      Runtime/PickupFizzler.cs
  3. 3 1
      Runtime/PickupMovementFixer.cs
  4. 1 1
      package.json

+ 10 - 0
Runtime/JumpPad.cs

@@ -56,6 +56,12 @@ public class JumpPad : UdonSharpBehaviour
         appliedVelocity = CalculateInitialVelocity(self.position, jumpTarget.position, -9.8f, arcTime);
         launchAnim.SetBool(animName, true);
         if (debug) Debug.Log("Jump Pad Controller: Animator State attempted to be set to True");
+        // Remote players get launched by their own client, and speed/velocity calls on them throw and halt this script
+        if (!colidedPlayer.isLocal)
+        {
+            SendCustomEventDelayedSeconds(nameof(EndLaunchAnim), arcTime-0.2f);
+            return;
+        }
         player = colidedPlayer;
         // Get speeds to reinstate after jump imobilization
         defaultRun = player.GetRunSpeed();
@@ -95,6 +101,10 @@ public class JumpPad : UdonSharpBehaviour
         player.SetRunSpeed(defaultRun);
         player.SetStrafeSpeed(defaultStrafe);
         if (debug) Debug.Log("Jump Pad Controller: De-Limited Player Mobility after" + arcTime.ToString() + " seconds");
+        EndLaunchAnim();
+    }
+    public void EndLaunchAnim()
+    {
         launchAnim.SetBool(animName,false);
         if (debug) Debug.Log("Jump Pad Controller: Animator State attempted to be set to False");
     }

+ 1 - 1
Runtime/PickupFizzler.cs

@@ -14,7 +14,7 @@ public class PickupFizzler : UdonSharpBehaviour
     public AudioSource fizzlerSound; // Sound to play when a pickup is fizzled
     public AudioSource playerEnterSound; // Sound to play when a player enters the collider
     public int fizzlerLayer = 8; // Layer number for the fizzler
-    public int pickupLayer = 9; // Layer number for the pickup
+    public int pickupLayer = 13; // Layer number for the pickup (VRChat's Pickup layer)
     public float fizzleDuration = 2.0f; // Duration for the fizzle effect
     public Material fizzleMaterial; // Material to apply during the fizzle effect
     private Material[][] originalMaterials;

+ 3 - 1
Runtime/PickupMovementFixer.cs

@@ -26,7 +26,9 @@ public class PickupMovementFixer : UdonSharpBehaviour
         previousTargetPosition = targetObject.transform.position;
     }
 
-    private void Update()
+    // LateUpdate runs after Update scripts and Animators have moved the target this frame,
+    // so the movement measured here matches this frame's deltaTime
+    private void LateUpdate()
     {
         Vector3 currentTargetPosition = targetObject.transform.position;
         targetVelocity = (currentTargetPosition - previousTargetPosition) / Time.deltaTime;

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
     "name": "dev.av2x.aumss",
     "displayName": "AUMSS - Artyom's Udon Modular Scripting System",
-    "version": "1.0.0",
+    "version": "1.0.1",
     "unity": "2022.3",
     "description": "UdonSharp utility scripts for VRChat worlds: jump pads, checkpoints, lasers, pickup helpers, timed teleports and the Linked Object System.",
     "author": {