Networking.LocalPlayer.GetJumpImpulse() returns 0 in Start()
closed
Zerithax
Exactly as the title says, for some reason Networking.LocalPlayer.GetJumpImpulse() is returning 0 for me when I run it in Start(), which is especially odd because GetRunSpeed() is working completely fine in the exact same code.
I placed the below code in a PlayerObject when encountering this issue. See the attached image for the Log result.
private void Start()
{
Owner = Networking.GetOwner(gameObject);
localPlayer = Networking.LocalPlayer;
if (Owner == localPlayer)
{
defaultPlayerSpeed = Owner.GetRunSpeed();
defaultPlayerJump = Owner.GetJumpImpulse();
Log($"Found speed of {Owner.GetRunSpeed()} ({defaultPlayerSpeed}) | Found Jump Impulse of {Owner.GetJumpImpulse()} ({defaultPlayerJump})");
}
}
Log In
Fax
closed
Thank you for the report! |KitKat| is correct: GetJumpImpulse correctly returns 0 because 0 is the default value.
Most worlds use the Player Mod Setter prefab to override the default jump impulse. This may happen after the Start event.
|KitKat|
The documentation states that the "Default is 0, so set this if you want to enable jump in your world. The default VRCWorld prefab sets this to 3."
I would suggest simply waiting one frame before getting the value so you can be sure that the World Descriptor has had time to set the value first.
In my opinion this Canny should be closed.