agmcleod

Members
  • Content count

    57
  • Joined

  • Last visited

About agmcleod

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Twitter
    agmcleod
  1. Hi there! You can change this line here: https://github.com/mrengy/pesky-squirrels/blob/4ad5a4863bca515811b277ea7143535f7a1404e2/boilerplate-master/js/game.js#L59 to do: me.state.change(me.state.MENU); That will load the menu screen :).
  2. That classic error. At least let/const usage in es6 will help prevent
  3. Worked for me, thanks @Lsmjudoka
  4. FPS is around 50 when it starts up, then hits 60. It seems when the page loads it's a tad slow, then speeds up once all the objects are created. I think the reason for this is because it has to load the image. Typically you do this in a loading state, show a progress bar or loading screen of some kind.
  5. How are you initializing this.game?
  6. That would do it lol. Added some checks to ensure it doesnt pick other lasers
  7. Hey delta, sorry just saw the reply. Here's a published version with the debug build: http://projects.agmprojects.com/wrath-test/. The update code i referred to use near the bottom of game_screen.js. After you click "Tap to start" and the countdown, use the mouse left button to shoot. It still spawns, but the mesh position and laser position equal the same value (in console log).
  8. I can publish a version of the game with this if possible. Otherwise i feel like it would take me a while to set this up
  9. Hello, so in a render loop, I am looping through all the objects that a laser can collide with, and perform an intersects mesh. This is only like 70ish objects total, so it's not entirely awful, but on my iPad mini i do notice some frame rate drops occasionally, so i'd like to improve it with octrees. Here's the code for the looping. This gets called in my render loop, after updating positions: GameScene.prototype.update = function (endScene) { this.player.update(); var enemies = this.wave.enemies; for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; endScene |= enemy.update(this.player); for (var l = this.lasers.length - 1; l >= 0; l--) { var laser = this.lasers[l]; if (enemy.mesh.intersectsMesh(laser.mesh, false)) { this.wave.removeEnemy(enemy); this.removeLaser(laser); } } } for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; laser.update(); for (var c = this.cubes.length - 1; c >= 0; c--) { var cube = this.cubes[c]; if (cube.intersectsMesh(laser.mesh, false)) { this.removeLaser(laser); } } for (var w = this.walls.length - 1; w >= 0; w--) { var wall = this.walls[w]; if (wall.intersectsMesh(laser.mesh, false)) { this.removeLaser(laser); } } }So yeah it's kinda gross. Using an octree instead, here's what i have: GameScene.prototype.update = function (endScene) { this.player.update(); var enemies = this.wave.enemies; for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; } for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; laser.update(); } var octree = this.scene.createOrUpdateSelectionOctree(); for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; var meshes = octree.intersects(laser.mesh.position, 1, false); for (var i = meshes.length - 1; i >= 0; i--) { var mesh = meshes.data[i]; if (mesh.name !== "ground" && mesh.name !== "player" && laser.mesh.intersectsMesh(mesh, false)) { console.log(mesh.position, laser.mesh.position); this.removeLaser(laser); if (mesh.name === "enemy") { this.wave.removeEnemy(mesh.refObject); } } } } return endScene;}The problem is, the data seems to return incorrect data. The laser intersects one of the cube objects, even though there should be none in range. Looking at the log, i see the mesh.position and laser.mesh.position have the same values. There something i missed here?
  10. Thanks! Since the webview in iOS 8 added webgl, i just used cordova. Initially I was going to use cocoonjs, but ran into some issues figuring out iAd with it.
  11. Small little action game of mine got pushed to the iOS app store this week. https://itunes.apple.com/us/app/wrathofthecube/id962976121?ls=1&mt=8. Free to play, check it out if you'd like
  12. Ah okay, reading the wiki page about the ellipsoid, it uses 0.5, 1, 0.5 as the default making it taller around the object. If i set it to 0.5,0.5,0.5 for both the player & the laser, it seems to be much more predictable.
  13. Thanks for your replies. In debugging this and messing with the ellipsoid values, is there a way to show the elliposid with the 2.0 debug layer? Here's what i have currently for the player's mesh: this.mesh.ellipsoid = new BABYLON.Vector3(0.5, 0.9, 0.5);this.mesh.ellipsoidOffset = new BABYLON.Vector3(0, 1, 0);Still acts a little funny though. One other thing a friend of mine noticed, if you switch on wireframes, you'll see the vertices in the ground. Go a bit below so you can see the diagonal one on screen. Aim the mouse towards it. The laser meshes will stop and slide up the line instead of going through it. Probably another ellipsoid bug on my part. But i find it interesting.
  14. Not so much a performance drop, but a weird correction. http://projects.agmprojects.com/topdown/ Use WASD to move around, left click the mouse to shoot at the red guys chasing you. Anyways, when moving along the plane, one might see the occasional stutter of the yellow cube. I am not sure why this is happening. The plane is flat, so i'm confused what would cause a mishap like that.
  15. Ah could someone maybe update the wiki page then? https://github.com/BabylonJS/Babylon.js/wiki/Using-the-debug-layer