Skip to main content
New Participant
April 20, 2025
Question

ForceHold on Mobile Broken?

let grabbleEntity = this.entity.as(hz.GrabbableEntity);
grabbleEntity.setWhoCanGrab([player]);
grabbleEntity.forceHold(player, hz.Handedness.Right, false);

My script works fine in the editor, but when I run it on the Web or Mobile, it doesn’t enforce the hold. Is this expected behavior? I am calling this when the player first enters the world. 

3 replies

NullValuePoint
Inspiring
April 22, 2025

Not 100% sure,  but it might be too fast. Seeing it to grabbable and then trying to force hold it in the same frame. 

New Participant
April 22, 2025

hmm I tried a timeout for 5 seconds... I don't think it's being too fast. 

PigeonNo12
Honored Contributor
April 22, 2025

Can you share more context around this scenario. I tried it on my end, it's working, so most likely I'm missing something to be able to repro it. A few questions:

* Is the grabbable object being spawned in?

* Do you have NPC players in the world?

* Can you share the full snippet of the code including the player enters world subscription in addition to the grab action please?

Upcoming Events : Build with a Mentor: Custom UI Thursday 3/20 at 5:00 PM PT Register March calendar of all Mentor Workshops and Office Hours