Echnaton Posted June 3, 2017 Share Posted June 3, 2017 Hello everybody I try to make a little voxel game and am changing from three.js to babylon.js. So far I like babylon.js very much. Its great :-). At the moment I have a problem which I can't solve. I use gravity, but when my camera should fall from somewhere high, it does only so after a key is hit and shortly after stops again. For each time i hit an arrow key it falls a little more. Here is a playground example based on the tutorial to show what I mean. Just click in the picture and press the back arrow. http://www.babylonjs-playground.com/#B0NTV4 Do you have any idea what i am missing? What can I do that it does not stop falling? Thank you Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 3, 2017 Share Posted June 3, 2017 Hello and WELCOME the behavior you mentioned is by default (for performance reason) but you can "hijack" it by calling camera._updatePosition(); Echnaton 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 3, 2017 Share Posted June 3, 2017 Yeah, welcome aboard, Echnaton! Yep, that line can be put in the renderLoop... works great. Also, I think... you can use camera._needMoveForGravity = true; once, outside-of renderLoop. See line 27... http://www.babylonjs-playground.com/#1FOXSC#4 Watch-out for falling cameras! GameMonetize and Echnaton 2 Quote Link to comment Share on other sites More sharing options...
Echnaton Posted June 4, 2017 Author Share Posted June 4, 2017 Thank you very much for your answers. The solution works perfect. :-) Wingnut and GameMonetize 2 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.