Search the Community

Showing results for tags 'intersectsmesh'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 4 results

  1. I'm making a game where there's a single sphere in the middle of the screen and random spheres move in and out and you have to press a key when a sphere intersects the sphere in the middle. If you press it at the right time the score should increase. I have it working with one but once I tried to implement it with multiple spheres the score started to increase whenever you pressed key even if the spheres aren't intersecting. Here's my code: RhythmGame.init() var scene = RhythmGame.scene; var stillMesh = scene.getMeshByID("SphereStill"); var sphere1 = scene.getMeshByID("Sphere1"); var sphere2 = scene.getMeshByID("Sphere2"); var sphere3 = scene.getMeshByID("Sphere3"); var sphere4 = scene.getMeshByID("Sphere4"); var sphereArray = [sphere1, sphere2, sphere3, sphere4] var tunnelMesh = scene.getMeshByID("tunnel"); setInterval(function(){ scene.beginAnimation(sphereArray[Math.floor(Math.random() * (3 - 0 + 1)) + 0], 0, 100, true); }, 1500); $('#canvasZone').keypress(function(){ if(sphere1.intersectsMesh(stillMesh)){ RhythmGame.updateScore(); } if(sphere2.intersectsMesh(stillMesh)){ RhythmGame.updateScore(); } if(sphere3.intersectsMesh(stillMesh)){ RhythmGame.updateScore(); } if(sphere4.intersectsMesh(stillMesh)){ RhythmGame.updateScore(); } });
  2. Hi, Why is it that when I have a mesh disabled (i.e. mesh.setEnabled(false)) any intersectsMesh by it or against it returns true? Setting the method's second parameter 'precise' to true does not help. This output seems counter intuitive and I do not believe it is what anyone would expect. In fact, my intuitive expectation is that by having the mesh disabled, any intersectsMesh on it or against it should return false (even if the mesh being tested with it is in the same position that it would appear in if enabled). What do you think? Playground showing the problem (watch out for the browser console which prints the result of the intersectsMesh method testing two exclusive spheres in position which one of them is disabled): http://www.babylonjs-playground.com/#PD7PP#0
  3. Question is about my half complete game. Here is my game: http://www.babylonjs-playground.com/#KBHU0#12 Use Arrow Keys to turn the cube. Game objective is to align the cube to catch the same color slab. Question: When the slab hit the cube (function checkHit()), how do I decide if the color of slab and the that side of the cube is the same? I am new to game development. Any suggestions on my code is very welcome. Another question: Press Up (watch direction of turn), then press Left, now again Up - notice that direction is reversed. How to correct this (to keep the same direction)? -Kaushik
  4. I'm currently working on a game, Playable here: http://filmsbykris.com/scripts/metal_bullets Code Here: https://github.com/metalx1000/metal_bullets/ Right now I'm using intersectsMesh to check for collisions. I have two questions. 1) Is there a better way to do this? 2) Can you check if an object intersects another without having to check them all? Here is my current code for enemy collisions. for(var i=0;i<Obstacles.length;i++){ var obs = Obstacles[i]; //console.log(wall.name + " is " + this.mesh.intersectsMesh(wall)); var col = this.check_collision(obs); if(col){break;} }Every time an enemy is updated/moves, I check it against ever object in the "Obstacles" array (which is an array with all meshes that are obstacles for enemies). I use the Obstacles array, that I created, so that I don't have to check every mesh in the scene, but it still seems like there should be a better way, because this is a lot of checking over and over again. I'm hoping there is a way to have it check if it's intersecting anything and then just check what that object is and if it's in the Obstacles array. Early on I tried using Cannon.js for this, but I had issues. Things like, if I apply physics to a wall, and that wall touched another wall, they would fly apart and hit other walls, and basically destroy the level. Also having a bunch of meshes with physics really slowed down the performance. But, maybe I'm just using it wrong. Thanks in advance for any help.