Search the Community

Showing results for tags 'solved'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 1638 results

  1. Hi. I followed this tutorial to create a game. The example works but when I tried to add some code to it I got a problem. class SimpleGame { constructor() { = new Phaser.Game(800, 600, Phaser.AUTO, 'content', { preload: this.preload, create: this.create }); } game: Phaser.Game; preload() {'logo', 'phaser2.png'); this.preloadGroup1(); // error 'this.preloadGroup1' is not a function this.preloadGroup2(); } preloadGroup1(){'group1', 'group1.png'); } preloadGroup2(){'group2', 'group2.png'); } } I got an error: 'this.preloadGroup is not a function'. It seems Phaser State call this inside it and can't find preloadGroup() which it's understandable because 'this' refer to SimpleGame object and not Phaser.State object. Strangely, calling or any property work flawlessly. Any way to work around this? Please don't tell me to write everything into preload function, I'd prefer not doing that.
  2. I have an application where I have an FPS like camera that moves around a scene. I want to be able to use a camTo function to move the player around the scene. I have a position v3 and target v3. If I do not have a rotation value, the camera is not looking at the target. Is there a way to calculate the rotation knowing the position of the camera and the position of the target. Is my approach to this incorrect? How do I correctly move my freecamera to the correct location and ensure that it is looking at my desired target?
  3. Hi, I did not find anything about that topic. How can I change the emit rate of a particle system after it started?
  4. I tried to show all of my meshes in the scene. In Playground it works fine If I load my scene like explained here, the array shows only [object][object]. What is the problem?
  5. Hi, I have a strange problem. Please take a look at the following scene. If you turn around 180° from where you start in the scene, the frame rate will decrease drastically if you look to the nearest corner. Please do not ask why I did some of this thinks like in the source. I stripped my whole code to make the problem more clearly. Can anyone explain why the fps is decreasing and what line of code is responsible for this? Thanks in advance.
  6. I am trying to make a menu screen with a centered title, some centered column headers, some right-aligned row labels, and some left-aligned row notes. relevant examples: Basics 06 Render Text Text Bounds relevant documentation: Phaser.Text This seems like it ought to be trivial, but none of my text alignment is working - it's all "left" all the time. I've tried declaring a non-left alignment (e.g. align:'center') on a style object before creating the text and I've tried assigning alignment to the text object immediately after creating it. Both of these methods appear to work trivially in the "Basics 06 Render Text" example. If I instead use anchor (e.g. .anchor.setTo(0.5,0.5) ), then that works. ----- My problem was that I hadn't understood the text.align vs. boundsAlign and had missed a crucial comment in the documentation about text.align: "Does not affect single lines of text.". text.align only aligns the text within the area that the text is actually rendered in. A single line of text is already taking up 100% of the width and height of the rendered text area, so it is already "aligned" in all possible ways (i.e. it can't be moved left, right, up, or down without changing which area it is being rendered in). boundsAlign aligns a rendering of text within a set of bounds - but these bounds must be set.
  7. In my application I have animation packages(babylon files) that are very large and take a while to download from the server. This download time is helped by using the enableSceneOffline and enableTexturesOffline in the manifest file, but we still have to deal with the initial load each time. Is there a way to load those so they are available in the background without having to render them on screen until we are ready for the user to interact with them? The load times are excessive for each package, but it would help if I could load a new babylon file to have it ready for when the user is done interacting with the first.
  8. I was talking to a 3d artist about the size of babylon files with animations. This has caused us some issue with loading but we worked around that by breaking up our files into smaller, more "digestable" pieces. We were wondering if anyone had thought about, or if there were any plans to create a way to apply animations to a mesh from an external file? I was thinking that separate animation files with just the animation data could be used to create and then play an animation. So I would load one mesh, and then just apply an animation to it rather than loading a mesh and all its associated animations with it. What are the implications of this? Maybe this is a terrible idea?
  9. I am using an animated character with different meshes for the head, body, body part markers etc. I am trying to create an arrow that points to a given body part marker,which is created in max and exported as part of the character animation, but when I get the position, it is always incorrect. If I just create a box in code and move it to the same place as the head let's say, it's position is wildly different than the position that is returned from "head.position". When I use the debug layer and check clickable labels, I get a perfectly placed label in the middle of the mesh. How do I get that location from the mesh itself? What am I missing. When I create a box: var box = BABYLON.Mesh.CreateBox('box', 5, scene); box.position works great as well. When I load my animated character, the bones have mesh representations, which I dispose of, but they all have the correct positions. It seems to be the meshes that are attached to the skeletons that has an issue. How do I get the position that the debugLayer uses?
  10. When swapping out meshes with large animations After a few swaps I get an OOM error. By swapping out animations I mean dispose of the previous mesh and load a new one. This was also an issue in THREE.js, but seems to be less of an issue because Babylon seems to handle files with large amounts of animations much better. However, it appears that both leave these animations in memory even after disposing of the mesh. What is the best way to dispose of a mesh with say, 20k frames of animation, and load another without getting an OOM. Thanks in advance for the help.
  11. I have a clock with hands for hour, minute, and second. While it is not a problem to rotate the hands according to the correct time, I am not getting the correct time. It seems like the hands are opposite where they are supposed to be. Exactly opposite. I put together a playground demo to show what I am doing. Has anyone had experience with this? This same formula was working correctly in THREE.js. Thanks in advance
  12. We have a character that has been rigged using CAT. Most of the animations that we have for the character plat without issue, but for some reason part of the face "slides" during some of the animations. There are bones in the face that correspond to what is sliding but we cannot find where or how this is happening in max. Here is a babylonjs playground example. focus the camera on the face and press the "P" key to see the animation. I also have the max file if it helps. It is very large though. 250+ MB I am not the artist for this, but both of us are at our wits end trying to figure this out. We were using three.js for this project but ported over to Babylon last week. Thanks in advance. Any help that anyone can offer would be appreciated.
  13. Good afternoon, I'm trying to implement mesh collisions instead of a physics system (turns out that it costs to much in performance and i don't have the time to implement it right now), at first look it looks simpler. Although... I wen't looking at the tutorial and at dad72 example, and I'm not beeing able to implement it. I don't understand the concept behind the moveWithCollisions function and the velocity vector3. In my game I don't have a velocity var, the player point and click and the ship moves to that place. So... If i understand the concept, I may adapt it. At first, i thought.. well, maybe the function will try to calculate the mesh destiny, so I directly putted de ship X and Z coordinates on the velocity vector3 and it didn't work. I pasted a bit of the code. Notice that selectedUnit[a].setVelocity(velocity); is calling the setVelocity method, this method calls moveWithCollisions with the velocit parameter. this is part of the units class and the selectedUnit is one array of Units Thanks in advance for the help. if ((posix!==0)&&(typeof(posix)!=="undefined")&&(isNaN(posix)===false)){ if (targetx === 0){ Number(targetx); targetx = Number(posix)+1; Number(targetz); targetz = Number(posiz)+1; } = new BABYLON.Vector3(posix,0,posiz); systems[0].calculateSunDistance(camera); //calculateSunDistance(systemB1,camera); systems[1].calculateSunDistance(camera); //calculateSunDistance(systemB2,camera); dx = targetx - posix; dz = targetz - posiz; rot = Math.atan2(dx, dz); len = Math.sqrt(dx * dx + dz * dz); if (len === 0) len = 1; dx = dx / len; dz = dz / len; if (rot!==0){ posfy = rot + Math.PI; } posfx = parseFloat(selectedUnit[a].getShipPosx()) + parseFloat(dx); posfz = parseFloat(selectedUnit[a].getShipPosz()) + parseFloat(dz); shiproty = posfy; shipx = Math.round(posfx, 1); shipz = Math.round(posfz, 1); shipid = selectedUnit[a].getShipId(); selectedUnit[a].setShipPos(shipx,shipz,shiproty); ship = selectedUnit[a]; //velocity = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(shiproty))) / 1, 0.5, parseFloat(Math.cos(parseFloat(shiproty))) / 1); velocity = new BABYLON.Vector3(parseFloat(shipx), 0.5, parseFloat(shipz)); //console.log(velocity); selectedUnit[a].setVelocity(velocity);