JohnK

Members
  • Content count

    662
  • Joined

  • Last visited

  • Days Won

    10

JohnK last won the day on February 19

JohnK had the most liked content!

1 Follower

About JohnK

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    http://babylonjsguide.github.io/

Profile Information

  • Gender
    Male
  • Location
    England, Buckinghamshire

Recent Profile Visitors

2,391 profile views
  1. I think the babylon.worker.js uses web workers to run some routines in a background thread whereas babylon.js just runs the code without threads. This is a case where I know the right words to put in a sentence but am not entirely sure I know exactly what they mean.
  2. As a very much beginner to the world of shaders I did produce some tutorials on them, as much for me to refer back to as anything else. The first is here http://babylonjsguide.github.io/advanced/Overview with links to one or two more here http://babylonjsguide.github.io/advanced.html (click on shaders button to see short list).Definitely not comprehensive but a start. Deltakosh also has a decent shader tutorial at https://www.eternalcoding.com/?p=113
  3. Perhaps you could share the articles where you found the terms joining and linking as in BabylonJS the term merging is used to form one mesh from many. However merging meshes means one material. For example merging the trunk and leaves on your tree would mean the they would both have to be the same colour. Also you could not have a character colliding with one tree. Have you looked at the solid particle system? You could make a forest from the trunks and branches (as separate solid particles) with their own colours and the forest would be one mesh. By making the forest mesh immutable then there is only one draw call. However if you wish a character to collide with a tree then it is possible but memory and CPU time is increased.
  4. I will give it go. When you set the camera target new values for alpha and beta are calculated. Alpha is calculated from x and z values using trigonometry, by using the initial settings for position and target with x and z values equal then alpha is calculate from 0/0 which is indeterminate and gives a null result so the mesh cannot be displayed. When you set an initial target with x and z not the same as the x and z positions then an alpha can be calculated and because of the way the code is ordered, setting a new position with x and z the same as x and z in the target still allows alpha to be calculated. Hence setting camera.target = model first stops the problem with your camera setting. However it would still be possible to give the camera positions where the x and z values were the same as the current target position. It would always be possible to check for this and adjust as necessary. IMHO it is not possible to do this automatically in the BJS code because although you could avoid it by changing the x and z values slightly but would not know whether the users intention was to adjust x or z singularly or together or positively or negatively.
  5. As far as I know you can only rotate or move the camera when you have a pointer or key down and aWeirdo's method will detect this. As far as scrolling goes then I think any zoom is a browser zoom not a BJS zoom and so there is no change of radius. IMHO without rendering and using scene.registerAfterRender you could only check for an camera.alpha change using setInterval to check every few milliseconds if oldAlpha was currentAlpha but alpha will only change if you are are moving the mouse with pointerdown so back to above. An alternative would be to use BABYLON.GUI and change alpha, beta and radius values on the click of a button, but then as you are clicking the button this event is captured and you can then switch rendering on during the onclick function. If you have other ways of checking for alpha, beta and radius values let us know.
  6. Taking out the comment on line 23 gives you the views you want http://www.babylonjs-playground.com/#2JBSNA#37 However if you just want to see the skull's top, front, left, right, back and bottom it is much simpler to use the camera's alpha and beta values http://www.babylonjs-playground.com/#FZJRWJ
  7. Welcome to the forum. There is some updating to the classes documentation as Deltakosh prepares for version 3.0 to go live, which has thrown some links out. However once notified DK is on top of it and you will find the links have been updated by DK about 7 mins before your last post. Let us know if you find any more broken links. EDIT see DK even beat me to notifying you.
  8. That is a very good reason and that will start the rendering if the user moves the pointer and so moves the camera. However you then said and asked to extend this The question then becomes what event starts and stops the object moving. If it is an external event such as a key press or pointer move then capturing that event works in the same way as aWeirdo showed. The following PG will also render when the key g is pressed and stop when s is pressed. NOTE click on scene before pressing key so scene has focus. http://playground.babylonjs.com/#3A2PUF#3. If it is a timed event then use setTimeout http://playground.babylonjs.com/#3A2PUF#4
  9. Interesting question! Mathematically possible but not straightforward. Might play with it over the next week or so, unless somebody already has the answer.
  10. Mmmmmmmmmmmmmm what is going to start the object moving? I know I will set a random time T milliseconds after which the object will move. Mmmmmmmm how will I know T milliseconds have passed? I know I will write a routine that that runs once every sixtieth of a second and see if the time has passed yet? Mmmmmmmmmm! No I wont I will just use new BABYLON.Animation and leave the rendering alone. Mmmmoral is I better have a very good reason to want to stop rendering else I am just going to give myself a lot of work for no good reason! Does it really matter that if nothing is going on then the BabylonJS engine is rendering the same screen upto 60 times a second?
  11. Hi and welcome to the forum. The answer is yes and I did it a couple of years ago so some bits are a bit hazy but here goes. The following github has two functions the first write the .babylon gile as text to a new page, the second downloads the fole to your computer. https://github.com/Cubees/Cubees.github.io/blob/master/factory/shared/exporter.js To see it working in context go to http://cubees.github.io And choose extrude or lathe. To do a whole scene read about serialize https://doc.babylonjs.com/classes/2.5/sceneserializer
  12. Have you read this topic not only a great demo the topic contains some good tips.
  13. Have you tried the followCamera ?
  14. Same Android version same Chrome on an old Galaxy 4 mini and no problem.
  15. It seems you need to set ambientColor for mesh as well http://doc.babylonjs.com/tutorials/environment#changing-the-ambient-color-sceneambientcolor However on mobile so cannot add to your PG