• Content count

  • Joined

  • Last visited

  1. allowing default style.cursor?

    What I don't understand is why when I pull babylon.js master and build (without making any changes to ts files), the /dist files generated already shows diffs. It looks like it is just placing things into a different order, but do not understand why? I cleaned node_modules from tools/gulp to be on the safe side, but same results. Anyway, here is the PR, thanks https://github.com/BabylonJS/Babylon.js/pull/2661
  2. allowing default style.cursor?

    Hello! I am not using ActionManagers or anything like that in a particular scene, but I would like to change the default cursor for my scenes to something else. I found that babylon will set style.cursor back to "" if it doesn't detect a mesh to use the hoverCursor property for. I changed my fork to instead refer to a defaultCursor property in babylon.scene.ts which defaults to the same empty string that is being used in the _onPointerMove function when it doesn't determine it should set the hoverCursor property for. Is that something that might be interesting to merge in? If so, I'll make a pull request. Thanks for a awesome library as always.
  3. Spotlight ray/beam artifact

    Thank you again!
  4. Spotlight ray/beam artifact

    http://www.babylonjs-playground.com/#3QUZ2P In my own project I recently started using BABYLON.Spotlights mounted to some other meshes which move around, and I noticed some strange artifact/ray that reflects on all surfaces, seemingly towards 0, 0, 0. ( look at bottom of the view in PG). I only see it start happening when I parent a FreeCamera (maybe any camera, dunno) to a mesh. same PG without the parenting > http://www.babylonjs-playground.com/#3QUZ2P#1 Is this something I am doing wrong?
  5. TypeScript preprocessor for vs community ?

    I don't know of a Visual Studio specific solution, nor a solution specific to any IDE for that matter. I have accomplished this using build/bundling process, gulp/browserify with the tsify, envify and uglify plugins. This is how I implemented it, hopefully it makes sense as I am just copy/pasting and not trimming it down to the bare example. gulp.task('browser:watch:min', ['browser:clean', 'browser:static:min'], () => { let bundler = browserify(path.join(__dirname, 'src', 'browserMain.ts'), { paths: ['./src'] }) .plugin(tsify, tsconfig.compilerOptions) .transform(browserifyCss) .transform(envify, { BUILD_FLAG: 'production', BUILD_MODE: 'browser' }) .plugin(watchify); bundler.on('update', () => { loadBundle(bundler, true) }); loadBundle(bundler, true); }); gulp.task('browser:watch:max', ['browser:clean', 'browser:static:max'], () => { let bundler = browserify(path.join(__dirname, 'src', 'browserMain.ts'), { paths: ['./src'] }) .plugin(tsify, tsconfig.compilerOptions) .transform(browserifyCss) .transform(envify, { BUILD_FLAG: 'development', BUILD_MODE: 'browser' }) .plugin(watchify); bundler.on('update', () => { loadBundle(bundler, false) }); loadBundle(bundler, false); }); function loadBundle(bundler, makeUgly) { let now = new Date(); console.log(` ${(now.getHours() < 10 ? '0' : '') + now.getHours()}:${(now.getMinutes() < 10 ? '0' : '') + now.getMinutes()}:${(now.getSeconds() < 10 ? '0' : '') + now.getSeconds()} reloading bundle...`); let newBundle = bundler.bundle().on('error', (error) => console.error(error.toString())) .pipe(source('bundle.js')); if (makeUgly) { newBundle.pipe(streamify(uglify())); } newBundle.pipe(gulp.dest(__dirname + '/build')) .on('end', function () { let now = new Date(); console.log(` ${(now.getHours() < 10 ? '0' : '') + now.getHours()}:${(now.getMinutes() < 10 ? '0' : '') + now.getMinutes()}:${(now.getSeconds() < 10 ? '0' : '') + now.getSeconds()} bundle reloaded...`); }); } 'browser:watch:min' and 'browser:watch:max' are the gulp tasks which will pass a different argument to envify, the BUILD_FLAG property in particular being used later. I do the same thing on the server side but just using gulp-envify and gulp-uglify. Then in a ts file, you can refer to BUILD_FLAG, which when compiled gets converted by envidy to the literal value passed in the gulp task. if ("development" === process.env.BUILD_FLAG) { console.log(`attachControl: TopDownFocusCameraMouseInput`) } When compiled (with browser:watch:min task in this example) becomes if ("development" === "production") { console.log(`attachControl: TopDownFocusCameraMouseInput`) } Finally, uglifys dead code removal would completely remove this from the emitted js file. Depending on your build setup you may be able to accomplish this with less pieces. There is a webpack loader https://github.com/nippur72/ifdef-loader that lets you use something closer to compiler directives, but I don't use webpack and don't really like the approach, for some reason the directives being in comments (that would be ignored if the ts gets built differently, I.E. without webpack) rubs me the wrong way. Hope this helps. I am also curious to see what solutions others might use.
  6. Problem with Typescript example

    Very cool. I have experimented with using Angular and Babylonjs before. One thing I ran into before I understood what was happening was ngZone causing horrible performance due to the way it monkey patches all asynchronous calls (including requestAnimationFrame) for its change detection. I found I had to disable change detection for these calls like so: this.zone.runOutsideAngular(() => { this.engine.runRenderLoop(() => { this.scene.render(); }); })
  7. Here is a PG to demonstrate the issue: http://www.babylonjs-playground.com/#ZI9AK7#13 If you click above the actual button you'll see events getting registered, but they certainly are not lining up with the actual button position. Seems like it happens anytime the width or height are set, even if its the direct descendant of the AdvancedDynamicTexture. This used to work, only noticed it on my project when I refreshed from preview the other day.
  8. Hi, I notice that when using texture mode and a button, the default scaling animation is not reversed if the mouse is not released over the button: http://www.babylonjs-playground.com/#ZI9AK7#7 Try clicking down on the button and moving the cursor before releasing. In my own project it behaves a bit differently, I actually have to release it over something over than the canvas to reproduce. Thanks for the great library in general and BABYLON.GUI in particular lately
  9. compiling with strictNullChecks: true causes compile error

    Done, thanks.
  10. This is a very minor issue, but it also has a very minor fix I think. When building a TS project which includes the latest preview babylon.js typings, with the strictNullCheck:true flag set, the following error happens during compilation: lib/babylon.d.ts(674,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'crossOrigin' must be of type 'string | null', but here has type 'string'. The Typescript provided lib.d.ts defines crossOrigin as 'string | null' as the error suggests. Admittedly I am not sure of the build process used for BJS, But I think that this line https://github.com/BabylonJS/Babylon.js/blob/92ab030b50fc277904a823be642755d3f0fef006/src/babylon.mixins.ts#L155 just needs to be changed to match the lib.d.ts shape ( string | null ). I've never contributed to this project, but can create a PR if you want.
  11. WorldSpaceCanvas scaling, children don't appear to scale correctly

    Not sure whether I should create a brand new topic for this, so I apologize if I should have. I noticed with the latest preview, that the original PG (and my own project started getting the following error, it seems to occur anytime the scale is set to zero: Uncaught Error: Can't invert matrix, near null determinant at Matrix2D.invertToRef (babylon.canvas2d.js:185) at Function.Matrix2D.Invert (babylon.canvas2d.js:144) at Rectangle2D.Prim2DBase.updateCachedStates (babylon.canvas2d.js:9136) at WorldSpaceCanvas2D.Prim2DBase.updateCachedStatesOf (babylon.canvas2d.js:8950) at WorldSpaceCanvas2D.Group2D._prepareGroupRender (babylon.canvas2d.js:11599) at WorldSpaceCanvas2D.Canvas2D._updateCanvasState (babylon.canvas2d.js:17734) at WorldSpaceCanvas2D.Canvas2D._render (babylon.canvas2d.js:17745) at e.callback (babylon.canvas2d.js:16554) at e.notifyObservers (babylon.js:2) at i.render (babylon.js:12) If I change the initial scale to .001 or something, the error no longer occurs. http://www.babylonjs-playground.com/#W9SZY#6 Other than that, really good! The various scaling / positioning I am doing on world as well as local canvas's are all working as expected. Great work.
  12. Why is BJS now mostly Typescript?

    I'm sorry a long time user of BJS is unhappy with the Typescript direction. But I'm also sorry to hear that core contributors to BJS are getting bummed out from negative feedback, that sucks. However I will say personally that the fact that BJS is written in Typescript (let alone having decent typings, using TS during my day job I am always excited when a npm module I learn about has @types ) was a huge attraction for me. I won't try to evangelize anyone who isn't sold on it, but I love the development experience and the safety it affords. I am not quite to the point where I feel like I can contribute meaningfully to BJS (mainly because my 3D skills are poor), but I know that Typescript lets those who are sold on it be much more productive and produce better code as a result. Anyway, my $0.02. Thanks again to everyone who makes BJS possible.
  13. Maybe this hasn't made it into the preview or the PG, or possibly I am using designSize wrong. But are these working right @Nockawa? http://babylonjs-playground.com/#2GDFI4 using position http://babylonjs-playground.com/#2GDFI4#1 using marginalignment Also I put a backgroundFill in, as I thought the idea of designSize was to grow/scale to fit the canvas. Sorry if I should have created another thread, but this seemed on topic.
  14. WorldSpaceCanvas scaling, children don't appear to scale correctly

    You the man, PG works as expected, as well as my own project when I take latest. Thanks again!