Leaderboard


Popular Content

Showing most liked content on 06/27/2017 in all areas

  1. 2 likes
    Like this: var p = BABYLON.Vector3.Project(new BABYLON.Vector3(0, 0, 0), BABYLON.Matrix.Identity(), scene.getTransformMatrix(), freeCamera.viewport.toGlobal(engine)); console.log(p.x); console.log(p.y);
  2. 2 likes
    Hi, welcome. You can pick which allows you to retrieve the item click a ground for example var pickInfo = ground.pick(evt.clientX, evt.clientY);var x = pickInfo.pickedPoint.x;var y = pickInfo.pickedPoint.y;var z = pickInfo.pickedPoint.z;sprite.position = new BABYLON.Vector3(x, y, z);In 2D you just need x and y
  3. 1 like
    Thanks for the reply! I did fix this with game.world.sendToBack(background); to place the background behind the ground, that was the main problem. Thanks for your time!
  4. 1 like
    Replying to myself again: the source of the problem is Phaser.Utils.Debug.boot(), which creates a new canvas every time it is called, which by default is every time a new Phaser.Game instance is created and booted. Only affects instances where the renderer is WebGL (or more precisely whenever renderType !== Phaser.CANVAS), and if enableDebug is true, which is the default. For completeness, here's an edited version of the above demonstration code that does not exhibit the memory leak (by virtue of disabling debugging): <!doctype html> <html> <head> <meta charset="UTF-8"/> <title>test</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/phaser-ce/2.8.1/phaser.js"></script> </head> <body> <button id="button">Click</button> <div id="canvas"></div> <script> window.onload = function() { var d, n, game; d = document.getElementById('button'); n = document.getElementById('canvas'); function preload() { } function create() { } function update() { } function handler() { if(game) { game.destroy(); game = null; } else { game = new Phaser.Game({ width: 800, height: 600, renderer: Phaser.AUTO, parent: n, enableDebug: false, state: { preload: preload, create: create, update: update }, }); } } d.onclick = handler; }; </script> </body> </html>
  5. 1 like
    Oh, i thought that there white circles are actual circles OK, i changed a lot, just run a diff or something like that to understand hats going on. 1. Moved eyes inside the head 2. changed anchor to (0, 0.5) 3. change rotation that it "jumps" to mouse position (+=) 4. using last event in RAF, to adjust eyes after head rotation.
  6. 1 like
    I just dont know what are you doing wrong. Make a separate fiddle, dont use your codebase. I understand that it takes time, but I assure you its actually the fastest way for us to achieve something.
  7. 1 like
    Responding to my own question: the problem appears to be in Phaser.CanvasPool. Creating a new instance creates a new canvas and adds it to the pool, destroy does not remove it from the pool, and creating a new instance does not cause a canvas in the pool to be re-used. Is this expected behaviour, and if so what is the correct way of removing unused canvases from the pool? Manually clearing the list works as a crude hack, but I assume there's some more elegant way of handling this.
  8. 1 like
    In the main entry point to your application, you can import directly there. Install PIXI with NPM, npm install --save-dev [email protected] Then, go into your 'main.js' / 'main.js' and add the following import * as PIXI from 'pixi.js'; // or // import {Sprite, Container, AutoDetectRenderer} from 'pixi.js'; // or // var PIXI = require('pixi.js'); Visual Studio Code 'SHOULD' pick up on the js maps from the dist folder in the pixi.js module.
  9. 1 like
    Hi everybody and welcome to my first topic in this forum ! Firstly, a lot of thanks for babylon's js developpers. Secondly, I'm a french newbie in developpment, 3D and in english language, so please, use not too much complicated words . My question is... is there a solution to know 2D position of a 3D mesh rendered on the canvas ? My aim is to render a sprite on the screen which represent a circle of selection around the mesh after picked it. Maybe a better solution than sprites already exists and i'm open to suggestions. In advance, thank you for your replies .