Wanted to try out using the NearMenu in an XR/VR environment, and ran into this. This is also a problem for me when trying to create a TouchHolographicButton. Is this possibly a version issue? I believe I have installed the es5 packages for Babylon, babylonjs and babylonjs-gui.
It seems to work fine in playground (other than properly positioning the menu, that’s next)
But when in my dev environment, I get
Unhandled Rejection (TypeError):
babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__.NearMenu is not a constructor
Follow-up question: how would you modify the distance the menu sits from the camera? I tried modifying the nearMenu’s default/min distance in it’s follow behavior, not sure if it’s working properly
something like
var near = new BABYLON.GUI.NearMenu("near");
manager.addControl(near);
let follower = near.behaviors //returns the followbehavior created by the constructor
follower.defaultDistance = 5;
you would probably also need to change the min and max distance
Yes, exactly. Just finished figuring it out. However, it’s probably better to access the behavior from defaultBehavior.followBehavior (you can also grab any other behaviors)
Hey Craig, thanks for checking in. Everything seems figured out - the version update to 5.0 was what I needed. The API/typedoc for NearMenu says ‘since 5.0.0’, but I think that’s the only place you can currently find it, so it is easy to overlook (as I did). I’d suggest making that info more visible, not sure how useful that is since it is a preview version though.