Laggy inputs in Horizon Worlds
I am trying to get lag free input for my game for Horizion Worlds.
In type script I am trying to get ray cast input taps and then move an object to that position or drag it where the cursor moves. However, there appears to be about 1/4th of a second lag no matter what I do. I have the script marked as local as suggested in the documentation but still there is a lag from the click on screen in Focus mode and when my actual object moves.
Does anyone know what I'm missing here? The automatic cursor that is drawn is lag free, but the object that I trying to move with click lags behind.
Here is the code using the sysEvents from one of the samples. Supposedly this should be running fully locally and therefore lag free, but it isn't.
// Tracking Focused Interaction inputs
this.connectLocalBroadcastEvent(hz.PlayerControls.onFocusedInteractionInputStarted, (data) => {
const firstInteraction = data.interactionInfo[0];
if (firstInteraction.interactionIndex !== 0) return;
this.MoveObjectToTouchPos(data.interactionInfo[0]);
}
});
Thoughts?
Hey! That was it! Thanks jackmw94β
I just needed to set the objectToMove.owner to be the owningPlayer of the entity. Wow... That was not obvious lol! Thanks so much!
Here is the code for anyone dealing with this same issue. This is a modification of the sysFocusedInteractionManagerLocal.tsthis.owningPlayer = this.entity.owner.get();
if (this.props.objectToMove) {
this.props.objectToMove.owner.set(this.owningPlayer);
}
For lag free input you must use the connectLocalBroadcastEvent, not the network version.