hcmetal Posted September 29, 2018 Share Posted September 29, 2018 Hello guys, More questions regarding using Babylon with React. How do I use pep.js for Babylon in React? I understand that pep.js enable pointer events on touch devices, and without it the drag, pinch and other touch interactions won't work. I already 'npm i pepjs'. What is the next step? Where should I import it or use it? The basics are done following the doc: https://doc.babylonjs.com/resources/babylonjs_and_reactjs Maybe I also try calling our React Master @brianzinn Thanks a lot! PS: There is a solved issue regarding loading assets with create-react-app if anyone is interested: Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 29, 2018 Share Posted September 29, 2018 I just edited the /public/index.html and put PEP in the page. You may want to use defer or async for faster load: <head> ... <script src="https://code.jquery.com/pep/0.4.3/pep.js"></script> </head> I think if you want to npm import that you just import for side-effects: import 'pepjs'; hcmetal 1 Quote Link to comment Share on other sites More sharing options...
hcmetal Posted September 29, 2018 Author Share Posted September 29, 2018 @brianzinn, it's working. Thank you so much for your help(s)! Also, to anyone that is trying the same thing, don't forget to add touch-action="none" property to the canvas. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.