Forum Discussion

mangothebuilder's avatar
7 months ago

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

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

    • mangothebuilder's avatar
      mangothebuilder
      Member

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

  • 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?