[1765] LateUpdate-scheduled calls get incorrect HumanBodyBones positions on desktop
needs more information
TapGhoul
- Create some kind of script like the following:
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon.Common.Enums;
public class BuggyBehaviour : UdonSharpBehaviour {
void Start() {
SendCustomEventDelayedFrames(nameof(_DoUpdate), 1, EventTiming.LateUpdate);
}
public void _DoUpdate() {
var p = Networking.LocalPlayer;
var bone = HumanBodyBones.RightHand;
var pos = p.GetBonePosition(bone);
var rot = p.GetBoneRotation(bone);
transform.SetPositionAndRotation(pos, rot);
SendCustomEventDelayedFrames(nameof(_DoUpdate), 1, EventTiming.LateUpdate);
}
}
- Notice that the position is totally wrong.
This may happen in VR, only tested on desktop thus far. Update and PostLateUpdate both work fine. This may also trigger in a regular LateUpdate() call, but I'm just providing a minimal repro case for the specific case I ran into.
This was tested with a pickup, so attach this to a gameobject with a basic primitive, and have a separate VRCPickup to pick up while watching the debug object.
Log In
_
_tau_
marked this post as
needs more information
Is this a bug specifically happening on the Open Beta, or does it exist on live too?
TapGhoul
Seems to be a problem on stable too. Attached are samples of this - in the second one, netHoldOffset is the value that it's looking for to figure out where to position the snowball relative to the LeftHand/RightHand HumanBodyBones anchor.
Build tested on stable is 1750.
The timed jittering is because of other optimizations I have going on for this in the actual production setup, this value is more smoothly/consistently off if local.
Phasedragon
This problem is the entire reason postlateupdate exists. Lateupdate is not expected to work reliably for humanbodybones
TapGhoul
Phasedragon Sure, but it looks like it's having offsets applied twice or something weird - I'd have expected the state to be at least somewhat consistent in LateUpdate. I would prefer it be in postlate, but I can't do SendCustomEventDelayedFrames with PostLateUpdate timing.
The thing is it looks like the offsets are being double-applied or something? The offset to where they are meant to be seems to depend on how far all bones up the IK chain are from some kind of pose (not sure which pose)
(also for tau, I'll double check)
Phasedragon
TapGhoul Last time I checked, LateUpdate humanbodybones gives you the animator positions, before IK
TapGhoul
Phasedragon Oh, then maybe that would explain why. Annoying that it means I can't reliably schedule stuff in late.
Ultimately, the missing feature that I'm trying to hackily implement is getting the position of an object in the player's hand - tracking data locally shows this correctly, but as I'm sure you're aware, remote's tracking data comes from the IK - which is a totally different location. And I have no idea how vrcpickup determines the correct position on remote, though as far as I can tell it seems like it just doesn't and instead syncs the position separately? I'm trying to have throwable snowballs that look correct on remote, even if not 100% accurate, but at least hopefully look better than a basic vrcobjectsync based impl due to needing other events and such to get it how I want (with proper linear regression of launch velocity and direction, as opposed to just the final frame - the dreaded "flick" timing)
Either way, it is what it is. If that's all that's happening, this canny can probably be closed.