Search the Community

Showing results for tags 'typescript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 182 results

  1. Hello , I'm super new to Typescript , html5 , and I'm looking for some direction, so I started my first "hello world" game and I would like to know how to host it(web host). I have windows hosting through Arvixe... not sure what is required I'm using visual studio 2015 and typescript Thank you in advance Jimmy
  2. [Help] Access function in html file

    Hello there, I am relatively new to game development. I have defined a function ShowAds() within the html index file <script type="text/javascript"> var version = 'dev', libs = [ ]; var game = new StuddGames.AppBoot(); function ShowAds() { console.log("Show Ad"); } </script> is there a way i can call this function from typescript within the game code? Thanks for your help
  3. I'm stuck with loading my meshes. I'm new to all the 3D and modelling so any thoughts are highly appreciated. Basically I want to extends Babylons default Mesh class called BaseMesh and add a 'load' function to it to get rid of clutter in my scene code. I'm extending this BaseMesh class for each model I have. My BaseMesh class: (Note that all code examples are written in TypeScript) // BaseMesh.ts class BaseMesh /* extends BABLYON.Mesh */ { public readonly BASE_URL: string; // I want these to be static public readonly MODEL_URL: string; // I want these to be static public readonly NAME: string; // I want these to be static public body; /* constructor( scene ) { // I don't know what to do here super( this.NAME //name scene // scene null // parent ? // source ); } */ public load( assetsManager: BABYLON.AssetsManager ) { return assetsManager.addMeshTask( this.NAME + ' task', // name "", this.BASE_URL, this.MODEL_URL ); } public onLoaded( results ) { // I don't know what to do here this.body = results.loadedMeshes[0]; } public update(): void {} }; A model class would looks like this: // Robot.ts class Robot extends BaseMesh { public readonly BASE_URL: string = '/models/'; public readonly MODEL_URL: string = 'robot.babylon'; public readonly NAME: string = 'robotMesh'; public update(): void { this.body.rotation.y += 0.03; } } In my code above I store the loadedMesh from the AssetsManager into this.body. But here is question 1: why is my model already showing on the scene when the meshtask has run? I'm only loading a mesh, I've not put anything about putting it on the scene. Question 2: How do I extend my BaseMesh class from BABLYON.Mesh so that the result (loadedMeshes) of my load function is "the mesh itself" (instead of an attribute this.body). For example this would mean I could change my update function to 'this.rotation.y += 0.03;' and just generally makes more sense. Question 3: I'm really confused about the relationship between my "code" and my "model/.babylon files". Is there any good documentation/tutorials about this? These questions range from: - when is it healthy to split different parts of a model in different files - do I apply textures in my code or do I do that in my .babylon file - do I apply animations in my blender file or do I code them - ... This was a pain to type, if you have any questions please do ask Thank you in advance!
  4. Hello, guys. I'm trying to set up a workplace using CreateJS and Typescript. So far I tried only to use VisualStudio for this. I see everyone using the "createjs." namespace, can't find it in .d files from here: https://github.com/borisyankov/DefinitelyTyped Or is there another way of using Typescript with all the typing, intellisense and debugging?
  5. I wrote an interactive neural network visualization web program where people can explore the inner workings of neural networks. Here is the description page (where I mention and link to BabylonJS in the FAQ): http://miabella-llc.com/ This is the browser-based application: http://www.miabella-llc.com/ANN/
  6. Hi guys, I am trying to create a Game with Ionic 2 (=> Typescript) and Phaser and so far it was fine... until that I tried to add the plugin Virtual Joystick. The line this.pad = this.game.plugins.add(Phaser.Plugin.VirtualJoystick); return an error about undefined "game" But the comment above this line works fine ... It's maybe that I don't use the correct syntax to call a plugin ... Please Help me import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angular'; import { Platform,AlertController } from 'ionic-angular'; import { Storage } from '@ionic/storage'; import { HomePage } from '../home/home'; /* Generated class for the Play page. See http://ionicframework.com/docs/v2/components/#navigation for more info on Ionic pages and navigation. */ ///<reference path="js/phaser-virtual-joystick.min.js"/> @Component({ selector: 'page-play', templateUrl: 'play.html' }) export class PlayPage { score: any; scoreObj: Number; game: Phaser.Game; map: Phaser.Tilemap; balloon: Phaser.Sprite; bg: Phaser.TilemapLayer; start: Phaser.TilemapLayer; hit: Phaser.TilemapLayer; cursors: Phaser.CursorKeys; pad; stick; test; constructor(public navCtrl: NavController, public navParams: NavParams,platform: Platform,public storage:Storage,public alertCtrl: AlertController) { platform.ready().then(() => { storage.get('scores'); storage.get('level'); }); } ionViewDidEnter(){ this.score = 0; this.scoreObj = 100; var innerWidth = window.innerWidth; var innerHeight = window.innerHeight; this.game = new Phaser.Game(innerWidth, innerHeight, Phaser.AUTO, 'myGame', {create: this.create, preload: this.preload,update:this.update, render: this.render}, true); } preload(){ this.game.load.spritesheet('balloon', 'img/balloon-01.png',112,150); this.game.load.image('lest','img/sac.png'); this.game.load.image('target','img/hole.png'); this.game.load.tilemap('level1', 'img/bg-test.json', null, Phaser.Tilemap.TILED_JSON); this.game.load.image('bg-test', 'img/bg-test.png'); this.game.load.atlas('arcade', 'img/arcade-joystick.png', 'img/arcade-joystick.json'); } update = () =>{ this.game.physics.arcade.collide(this.balloon, this.hit,() => { this.balloon.kill(); this.score = this.score + 3; console.log("hit"); }); this.game.physics.arcade.collide(this.balloon, this.start); this.game.physics.arcade.collide(this.balloon, this.bg,() => { this.balloon.kill(); console.log("bg"); this.score = this.score - 1; }); this.game.input.update(); if (this.cursors.left.isDown) { this.balloon.position.x -= 5; } else if (this.cursors.right.isDown) { this.balloon.position.x += 5; } } render = () =>{ this.game.debug.body(this.balloon); } create = () =>{ /*var plugins = new Phaser.PluginManager(this.game); console.log(plugins);*/ this.pad = this.game.plugins.add(Phaser.Plugin.VirtualJoystick); this.game.physics.startSystem(Phaser.Physics.ARCADE); this.cursors = this.game.input.keyboard.createCursorKeys(); this.game.world.setBounds(0, 0, 9600,800); //MAP var map = this.game.add.tilemap('level1',9600,800,9600,800); map.addTilesetImage('bg-test'); this.hit = map.createLayer('hit'); this.start = map.createLayer('start'); this.bg = map.createLayer('bg'); //BALLOON this.balloon = new Phaser.Sprite(this.game, 192, 490, 'balloon'); this.balloon.debug = true; this.game.world.addAt(this.balloon, 3); this.game.physics.enable(this.balloon, Phaser.Physics.ARCADE); this.balloon.body.gravity.y = 15; this.balloon.body.collideWorldBounds = true; this.balloon.inputEnabled = true; this.game.camera.follow(this.balloon, Phaser.Camera.FOLLOW_LOCKON, 0.1, 0.1); this.balloon.animations.add('fly', [ 0, 1, 2, 3, 4, 5], 20, true); this.balloon.body.velocity.y = 10; // GAME map.setCollision([1,2,4,5],true,this.bg.index,true); map.setCollision([6],true,this.hit.index,true); map.setCollision([3],true,this.start.index,true); } }
  7. Hi, So, I've been following many tutorials but appear to be stuck at the first hurdle. I don't appear to be able to use the Debug Inspector if I'm using TypeScript and ES6 imports. I've setup my first scene using the initial tutorial (a sphere and a surface) on the website just fine using the TypeScript documentation (creating a Game class and so on). To do this in the ES6 way I import BabylonJS from node_modules by doing import * as BABYLON from 'babylonjs'; at the top of my .ts file and it works like a charm. Then I add this.scene.debugLayer.show(); to show the debug panel and I'm then faced with the following error in the Chrome debug console: babylon.inspector.bundle.js:408 Uncaught ReferenceError: BABYLON is not defined at INSPECTOR (babylon.inspector.bundle.js:408) at Object.t (babylon.inspector.bundle.js:408) at __webpack_require__ (babylon.inspector.bundle.js:21) at Object.<anonymous> (babylon.inspector.bundle.js:49) at __webpack_require__ (babylon.inspector.bundle.js:21) at babylon.inspector.bundle.js:41 at babylon.inspector.bundle.js:44 This is because it's absolutely right, the namespace BABYLON isn't included globally, my application is ES6, imports libraries where needed and then concatenates using Webpack. I moved to BabylonJS because it's dev team seemed to embrace TypeScript and ES6 but can't believe that something like this would have been overlooked? So that leads me to thinking I'm doing something wrong here. The only way I can see this working (which I found some libraries to do) is if the show() function to take the BABYLON object directly as an optional parameter, rather than expect for it to exist on the window (because it won't if you're importing ES6 style and webpacking). Open to thoughts and suggestions on this one as I'm new to BabylonJS. If I'm right with the above and it's just not something that has been done yet, I don't mind submitting a pull request.
  8. Hey all, just wondering if anyone could spare their knowledge on getting started with PIXI.js with Typescript I've made a couple of simple games now using PIXI.js and love it! Though really find javascript a pain to use as the games get bigger with all code being in 1 js file. What I want to start doing is making a library around PIXI.js for common things I will need (e.g. controls, grid layouts, etc) and build it up from there. Something so simple with UnityC# and even FlashAS3 that I always took for granted! I understand Typescript maybe the best way to do this, though am a little confused about the difference between all the options (Browserify, Babel, ES6, Typescript etc) what they all actually do what if any of those I will need, and what is the best way forward! Many thanks for any advice!
  9. A small simple multiplayer game https://github.com/code0wl/Multiplayer-Phaser-game There is also book that I have just published showing the steps to take to create such a game Preview: http://www.codeowl.tech:3000/
  10. Good evening all, My name is Christopher, and I have decided to use the Babylonjs npm repo. Question Once you include the babylonjs npm library through npm install how do you activate the extensions which are included? the attached file-structure.png shows the file-tree which is created in node_modules after using npm install. I am trying to use the included gui extension specifically. Environment Angular, Node, and Express, compiled using webpack Library npm babylon js To install the npm library into my project's node_modules: npm install --save babylonjs then my component has the import statement below: import * as BABYLON from 'babylonjs'; The above statement will utilize the babylon.module.d.ts file in the attached image and babylon.max.js This lets me use the BABYLON class with types perfectly as expected. However, none of the files in the gui folder in the attached image are hooked up. How would I go about activating this extension?? Solutions I've attempted thus far 0) just a normal import of the main babylonjs module: import * as BABYLON from 'babylonjs'; All core BABYLON methods and properties are accessible. However, BABYLON.GUI gives the following typescript error: "Property 'GUI' does not exist on 'typeof BABYLON'." Which is to be expected, since none of the gui files are hooked up. 1) using CDN for everything in index.html. <head> <!-- base href="/" is used for angular2 routing --> <base href="/"> <title>some website</title> <link id="favicon" rel="icon" href="public/assets/favicon.png"> <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script> <script src="https://preview.babylonjs.com/cannon.js"></script> <script src="https://preview.babylonjs.com/oimo.js"></script> <script src="https://preview.babylonjs.com/babylon.js"></script> <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script> </head> This works, however, is not ideal, and defeats the purpose of the npm library. Also, the typescript definition files have to be maintained separate, either through the tsconfig.json, or in the component with a ///ref tag, and is very finecky. 2) using npm for babylon, and CDN for gui. Does not work, this method throws errors, because the CDN script tag in the head of index.html is compiled before the npm module, meaning the babylon class this extension extends does not exist at that time. 3) Using a second import to try to include the BABYLON.GUI class extension. import * as BABYLON from 'babylonjs'; import 'babylonjs/preview release/gui'; there is no .module file in the gui filepath so npm doesn't find anything there, so the second import fails. I've looked everywhere, including the docs and haven't found a clear solution. So how do we activate these extensions? They are included in the npm repo so naturally the devs want us to use them, and I'd love to take advantage of them
  11. I was trying to layout 3 columns of buttons. The buttons are GUI.Controls. Each column could be a GUI.StackPanel. As far as adding the 3 StackPanels to the texture you might add them to the GUI.AdvancedDynamicTexture using addControl(control :Control). No idea what would happen layout wise. Adding a StackPanel to an AdvancedDynamicTexture works though. If you were to do this in Typescript you would error GUI.StackPanel inherits from GUI.Container. GUI.Control is a root class. Should not the AdvancedDynamicTexture signature for add/removeControl be: public addControl(control: Control|Container): AdvancedDynamicTexture You might also add the 3 stackPanels in to a larger one with horizontal orientation. You could expect to know what would happen. Container.addControl seems to have the same problem, yet Control.AddHeader() does that.
  12. Hi, Phaser devs! I'm developing a game using Phaser with TypeScript and what I'm trying to achieve is this: var component:AwesomeComponent = actor.getComponent<AwesomeComponent>(); I know there's a workaround by constructing objects of type T. But I don't like it because I'd probably need to define tons of different constructors to represent all differents kinds of components. What I'm doing so far is passing a string with the type (of course a number would be better, but I'm still prototyping): getComponent<T>(componentType:string): T { for (let i = 0; i < this.components.length; i++) { if (componentType == this.components[i].componentType) { return <T><any>this.components[i]; } } return undefined; } It works, but the result is not good, you have to type the class name twice: var animComp = actor.getComponent<AnimationComponent>("AnimationComponent"); Any suggestions on how to solve it? I know there`s a way to do it, because Unity does exactly that in JavaScript. Thank you for your time!
  13. Hi, I'm coming from AS3/Flash background, currently researching possibilities of HTML/WebGL development. For the past week I've been trying out various approaches to js, ended up focusing on Typescript. I'm currently struggling to pick and setup an IDE. Currently I'm using Visual Studio Express, however it lacks essential functions like code generation and templates. What is your ts IDE of choice? What are some tools/configuration tips you use to make the development easier? thanks, kihu
  14. I'm getting ready for the js13k competition by refining and expanding my TypeScript Game Framework MINI.ts https://github.com/LatteDrift/MINI.ts with the goal to let me make 2D games as fast as possible. My current plans are to work on Clean up Canvas Renderer Implement 2D WebGL renderer Implement Steering Behavior Refine basic physics Implement QuadTrees and Chunking Implement Terrain generation Implement some standard UI elements Improve the build process and get the TS code to generate JSDocs so that I can use Google's Closure compiler to get a smaller file size I'm looking for other ideas of features I might need later on or that make help speed up developer later on.
  15. Phaser + Typescript issue

    I've got an issue with phaser and Typescript where my classes that extend Phaser classes aren't recognizing the Phaser class fields. I posted a pretty detailed stackoverflow question about it, but was wondering if anyone on here might have a suggestion. Feel free to reply here or there. Here's the details: https://stackoverflow.com/questions/45091893/cannot-access-base-class-properties-in-typescript/45100163#45100163
  16. Hi, I would like to develop a game in Babylon but I would like to use typescript. Is there any 'getting started' guide? ( as i wasn't able to find any). If there isn't, can I please be pointed in the right direction as to how to go about doing this? If I get responses, I would be happy to submit a tutorial to assist others. Also, is there a way where one can provide/submit tutorials? Thanks, bws.
  17. Weird typing issues..

    Hi, I'm getting some really odd issues when I am trying to extend Babylon JS objects. Example: class Scene extends BABYLON.Scene { } class Game { public engine: BABYLON.Engine; public currentScene: Scene = null; } Mesh = BABYLON.Mesh.CreateGround("newGround", 1000, 1000, 1, newGame.currentScene); Gives me the following errors: (9,69): error TS2345: Argument of type 'Scene' is not assignable to parameter of type 'BABYLON.Scene'. Property '_environmentTexture' is protected but type 'Scene' is not a class derived from 'Scene'. Is this something that is not supported? Weird thing is I had this working and then suddenly it stopped.. Thanks! -StarToaster
  18. Pixi.js + TypeScript boilerplate

    After a couple of days working with Pixi.js, I've built up a simple boiler plate for the TypeScript language I'm glad to share: https://github.com/yahiko00/PixiProject The game loop with a FPS meter is already implemented. This boiler plate supports source maps, incremental builds, unit tests and browser auto-refresh. Maybe this could be helpful. Feel free to comment. There is certainly a room for improvement. Cheers!
  19. I'm trying to crop a Phaser.Text, so I can make something similar to the As3 TextField class (where your text is inside of a mask). But the crop method is not working, here is what I did: this.pText = new Phaser.Text(this.game, 0, 0, text, style); this.pText.crop(new Phaser.Rectangle(0, 0, 20, 20), true); this.pText.updateCrop();
  20. What physics engines are available for Javascript and/or Typescript? I've searched myself but maybe there's one or two I missed. I also found a post in these forums but that's over two years old now; It's a little disappointing to see that some of them aren't actively developed and lacking a lot of features. I put together a test to compare the different engines I tried - I've attached the files if anyone wants to try it out. Here are the engines I've tried: PhysicsJs http://wellcaffeinated.net/PhysicsJS/ - Incomplete: lacking simple features like constraints - Seems like it was last updated 2 years ago - Possibly the worst performance - Strange API (in my opinion) and difficult to use - Built in mouse interaction behaves strangely MatterJs http://brm.io/matter-js/ - Also incomplete and lacking constraints - Has a built in mouse constraint but it acts strangely - Updated recently - Simple and easy to use - Doesn't handle stress test well p2.js http://schteppe.github.io/p2.js/ - Complete - Updated within the last few months - Doesn't handle stress test well - Easy to use - Good documentation Box2DWeb https://github.com/hecht-software/box2dweb - Complete - everything you would expect from Box2D - Last updated one or two years ago - Semi-poor documentation - you have use the box2d flash documentation which is fairly thorough but slightly outdated - Much faster and a lot more accurate than the above three libraries. Nape http://napephys.com/ - Complete - lots of features - but isn't very active - Has a great marching squares utility which can convert bitmaps into polygons - Good site and documentation - Easy to use but the pooling get/dispose stuff can be a bit confusing - Similar (or maybe even slight better) performance to Box2DWeb and possibly more accurate - Large - minified it's still 1.7MB The one problem with Nape though is that it isn't really meant for Javascript and I had a lot of trouble getting it set up in Typescript. There were some project to convert it to js and generate definition files but I had to modify them a lot to get something complete that worked for me. I also had to manually convert the debug draw classes from as3 to js and Easeljs. Luckily that only needs to be done once - after that I didn't have any problems using it though. I also tried PhysicsType2D (http://physicstype2d.com/) but couldn't get it to work. Overall I was a bit disappointed; In terms of performance, the 'native' js libraries fell short by a lot compared to the two ported ones, and on top of that they lacked a lot of important features. Even the ported ones didn't perform as well as their Flash/As3 versions - the Nape stress test (you can find it here) which I copied, runs significantly better in flash. PhysicsLib.zip UPDATE: You can find the updated github repo here: https://github.com/cmann1/Javascript-Physics-Library-Tests/
  21. I am wondering why the renderer.backgroundColor property is not public in TypeScript. In order to get directly access to this useful property, I needed to create a helper class to expose this attribute: class GameRenderer extends PIXI.WebGLRenderer { public backgroundColor: number; } If anyone has an explanation, I would be interested to read it. Thanks!
  22. Good afternoon my name is Gary a pleasure, I am new and decided to raise babylon on the recommendation of a friend. I can do the basic example of the site (version js), but now I try to do it using the version typescript, but doing so I get the following error: src/ts-reference/babylon.2.5.d.ts(2,11): error TS2300: Duplicate identifier 'InstancingAttributeInfo'. src/ts-reference/babylon.2.5.d.ts(29,11): error TS2300: Duplicate identifier 'EngineCapabilities'. src/ts-reference/babylon.2.5.d.ts(71,11): error TS2300: Duplicate identifier 'Engine'. src/ts-reference/babylon.2.5.d.ts(1145,11): error TS2300: Duplicate identifier 'Node'. src/ts-reference/babylon.2.5.d.ts(1254,11): error TS2300: Duplicate identifier 'PointerEventTypes'. src/ts-reference/babylon.2.5.d.ts(1270,11): error TS2300: Duplicate identifier 'PointerInfoBase'. src/ts-reference/babylon.2.5.d.ts(1279,11): error TS2300: Duplicate identifier 'PointerInfoPre'. src/ts-reference/babylon.2.5.d.ts(1288,11): error TS2300: Duplicate identifier 'PointerInfo'. src/ts-reference/babylon.2.5.d.ts(1295,11): error TS2300: Duplicate identifier 'RenderingGroupInfo'. src/ts-reference/babylon.2.5.d.ts(1337,11): error TS2300: Duplicate identifier 'Scene'. src/ts-reference/babylon.2.5.d.ts(2083,11): error TS2300: Duplicate identifier 'Action'. src/ts-reference/babylon.2.5.d.ts(2115,11): error TS2300: Duplicate identifier 'ActionEvent'. src/ts-reference/babylon.2.5.d.ts(2156,11): error TS2300: Duplicate identifier 'ActionManager'. src/ts-reference/babylon.2.5.d.ts(2257,11): error TS2300: Duplicate identifier 'Condition'. src/ts-reference/babylon.2.5.d.ts(2268,11): error TS2300: Duplicate identifier 'ValueCondition'. src/ts-reference/babylon.2.5.d.ts(2289,11): error TS2300: Duplicate identifier 'PredicateCondition'. src/ts-reference/babylon.2.5.d.ts(2295,11): error TS2300: Duplicate identifier 'StateCondition'. src/ts-reference/babylon.2.5.d.ts(2306,11): error TS2300: Duplicate identifier 'SwitchBooleanAction'. src/ts-reference/babylon.2.5.d.ts(2316,11): error TS2300: Duplicate identifier 'SetStateAction'. src/ts-reference/babylon.2.5.d.ts(2323,11): error TS2300: Duplicate identifier 'SetValueAction'. src/ts-reference/babylon.2.5.d.ts(2334,11): error TS2300: Duplicate identifier 'IncrementValueAction'. src/ts-reference/babylon.2.5.d.ts(2345,11): error TS2300: Duplicate identifier 'PlayAnimationAction'. src/ts-reference/babylon.2.5.d.ts(2355,11): error TS2300: Duplicate identifier 'StopAnimationAction'. src/ts-reference/babylon.2.5.d.ts(2362,11): error TS2300: Duplicate identifier 'DoNothingAction'. src/ts-reference/babylon.2.5.d.ts(2367,11): error TS2300: Duplicate identifier 'CombineAction'. src/ts-reference/babylon.2.5.d.ts(2374,11): error TS2300: Duplicate identifier 'ExecuteCodeAction'. src/ts-reference/babylon.2.5.d.ts(2379,11): error TS2300: Duplicate identifier 'SetParentAction'. ... src/ts/babylon.ts(7962,15): error TS2417: Class static side 'typeof Box' incorrectly extends base class static side 'typeof _Primitive'. Types of property 'Parse' are incompatible. Type '(parsedBox: any, scene: Scene) => Box' is not assignable to type '(parsedVertexData: any, scene: Scene, rootUrl: string) => Geometry'. Type 'Box' is not assignable to type 'Geometry'. Types have separate declarations of a private property '_scene'. src/ts/babylon.ts(8073,11): error TS2300: Duplicate identifier 'GroundMesh'. ... src/ts-reference/babylon.2.5.d.ts(16940,11): error TS2300: Duplicate identifier 'DefaultRenderingPipeline'. src/ts-reference/babylon.2.5.d.ts(16995,11): error TS2300: Duplicate identifier 'LensRenderingPipeline'. src/ts-reference/babylon.2.5.d.ts(17086,11): error TS2300: Duplicate identifier 'SSAO2RenderingPipeline'. src/ts-reference/babylon.2.5.d.ts(17197,11): error TS2300: Duplicate identifier 'SSAORenderingPipeline'. Looking in this same forum I found that someone said that the solution was to update according to this version: https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/babylon.d.ts but it does not work: my code: game.ts file /// <reference path = "../ts-reference/babylon.2.5.d.ts" /> class Game { private _canvas: HTMLCanvasElement; private _engine: BABYLON.Engine; private _scene: BABYLON.Scene; private _camera: BABYLON.FreeCamera; private _light: BABYLON.Light; constructor(canvasElement : string) { // Create canvas and engine this._canvas = <HTMLCanvasElement> document.getElementById(canvasElement); this._engine = new BABYLON.Engine(this._canvas, true); } createScene() : void { // create a basic BJS Scene object this._scene = new BABYLON.Scene(this._engine); // create a FreeCamera, and set its position to (x:0, y:5, z:-10) this._camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 5,-10), this._scene); // target the camera to scene origin this._camera.setTarget(BABYLON.Vector3.Zero()); // attach the camera to the canvas this._camera.attachControl(this._canvas, false); // create a basic light, aiming 0,1,0 - meaning, to the sky this._light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), this._scene); // create a built-in "sphere" shape; with 16 segments and diameter of 2 let sphere = BABYLON.MeshBuilder.CreateSphere('sphere1', {segments: 16, diameter: 2}, this._scene); // move the sphere upward 1/2 of its height sphere.position.y = 1; // create a built-in "ground" shape let ground = BABYLON.MeshBuilder.CreateGround('ground1', {width: 6, height: 6, subdivisions: 2}, this._scene); } animate() : void { // run the render loop this._engine.runRenderLoop(() => { this._scene.render(); }); // the canvas/window resize event handler window.addEventListener('resize', () => { this._engine.resize(); }); } } window.addEventListener('DOMContentLoaded', () => { // Create the game using the 'renderCanvas' let game = new Game('renderCanvas'); // Create the scene game.createScene(); // start animation game.animate(); }); index.pug doctype html html head title= title meta(name='viewport', content='width=device-width, initial-scale=1.0', charset="utf-8") style include ../css/style.css script include ../js/babylon.2.5.max.js include ../js/bGUI.js include ../js/hand.min.1.3.8.js include ../js/cannon.js include ../js/game.js body h1= message div#GUI canvas#renderCanvas
  23. Hi, Someone have tried to use LegacyPbrMaterial with webpack? I copied file babylon.legacyPbrMaterial.min.js and made import in project (import "babylonjs/babylon.legacyPbrMaterial") but after that I get error Uncaught ReferenceError: __extends is not defined at babylon.legacyPbrMaterial.js:1 at BABYLON (babylon.legacyPbrMaterial.js:1) at Object.exports.byteLength (babylon.legacyPbrMaterial.js:2) at __webpack_require__ (bootstrap 3ce2b0a…:19) I have same erro if i try ti use inpsector. I am missing some config for webpack or typescript?
  24. Hello I want to run Getting Started Example in TypeScript on JSFiddle: https://jsfiddle.net/8Observer8/z4vo5u5d/68/ But an error occurs on the line 50 "this._scene.render();" Thank you in advance