Jump to content

Search the Community

Showing results for tags 'distance'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 12 results

  1. suppose you have two different lines: game.physics.arcade.overlap(pl, bat, function(sp, sp2) {sp2.kill()}) and if (game.physics.arcade.distanceBetween(pl, bat) < 222) {bat.kill()} the top detects when the player touches a randomly placed bat in a group and kills it, the second detects when the player is in RANGE of a randomly placed bat in a group and kills it. the problem is the second one doesn't work. i'm essentially looking for a way to merge these two so that the bat in line 2 dies the way the one in line 1 does. this doesn't seem to work either: if (game.physics.arcade.distanceBetween(pl, bat, function(sp, sp2) < 222)) {sp2.kill()}
  2. I have recently run into a problem with the physics joints in Babylon. I add a distance joint between two impostors in my scene, but after some time, I would like to remove that joint. Currently on the docs, there is no reference to a removeJoint function, and after looking into some of Babylon's source code, I found the function link: https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/babylon.physicsEngine.ts However, the function appears as if it is not complete, and I am unsure of the proper way to access it. Is there a way to properly remove a physics joint?
  3. Hi, I need some help for Vector calculation... Here is a playground. I'm looking for the position between the camera and a mesh, but at a fixed distance before the mesh... Many thanks !!
  4. Is there a way to control the distance or zooming of the reflected image. Check the two screen shots... Look at the mountains and scenery reflected in the larger sphere. The fist shot is from unity and it SHOW MORE of the reflected scenery behind... The second shot is my babylon but the reflected images are MUCH closer or ZOOMED in more so you see LESS of the reflected scenery in sphere... How can I control the ZOOM or reflected image distances ??? First Shot (Unity Rendered): Second Shot (Babylon Render) And Notice the difference in the ZOOM factor of the reflected scenery I need to ZOOM OUT a touch so it can match the WYSIWYG design time render of the unity scene NOTE: I luv how CRISP and CLEAN the baked shadows are... SWEET Yo @Deltakosh ... I am working on sending up the toolkit with documentation... Can you PLEASE start to work on that SHADER BUG/ISSUE where you cant have a ambient occlusion texture and a lightmapTexture (use as shadow map) at the same time... If people DONT KNOW that there is an issue and try to bake lights but wonder why they dont see the shadows... Most likely that scene (especially if you download from the asset store) will have ambient occlusion textures... So you won't see shadows in you scene. They show up in the sample screen shots I post in other thread because I went and REMOVED the ambient occlusion from the floor and walls. I will be uploading the first part of toolkit (The Scene Manager) and that Starting Documentation Stuff I told you about... Anyways, if you can do that so when folks get there hands on the toolkit, it will work
  5. Hello guys... Got another tough one form me, hopefully someone can help. I am making a component for the BabylonJS toolkit to support LODGroup... to automatically build LOD support for meshes. In unity, when setting up a LODGroup... the levels are specified in percent: The documentations says "The percentages in the LOD bars represent the fraction of the view frustum depth where that LOD level becomes active. But in Babylon we apparently use actual distance values to setup LOD... My question is how can I convert these percentage values to distance to mesh.addLODLevel ??? Yo @Deltakosh and @Sebavan or @Wingnut ... SOMEBODY Please chime in here
  6. Hey. Was planning to do something big with babylon, but realized that chrome has got some problem with using all the computer's specifications, and may lag twice as much than a normal appliaction, so I wanted to kow how to (if you can) modify the render distance. thanks.
  7. There is a player and some obstacles. The obstacles are some random rectangles. The task is to get the distance between the player and the nearest object in front of him. To do so I create lineOfSight in render method. My idea is to find its intersections with the lines forming the boxes, that float around. The problem is that I can't find the coords of the vertices of the boxes, as long as they are rotated. So there are basically two questions: how to find the vertices of the objects? is it a way to go? I mean, maybe there are some better approaches to this task. Here is my code. You can simply copy it and paste here, to see what it does.
  8. Hi I need to find the distance between a player sprite and the closest sprite to it in a group of sprites, I know this can be done by iterating through each of the sprites in the group and checking them individually however, I was hoping phaser had a built in way of accomplishing this. Once the player is within a certain distance, it will die so if phaser has an event for this that will work as well. Thanks for any help
  9. Hey guys I am trying to figure something out. I have a scene with a handful of identically sized boxes that can be moved around and rotated independently. When I move a box I can check which other box is closest to it and whether it is "in range" (ie distance is less than a set value) by checking distance between currentBox.position and each boxes.position. If they are in range then I can highlight it somehow (currently I set .visibility on both boxes to 0.5). This works quite well. When boxes are moved out of range again they become unhighlighted (ie .visibility=1 is set to 1); However I want to make it more specific and highlight the specific face on each box that are closest. Context: this is a first step to creating a kind of "snap-to" function that will allow boxes to be snapped together without needing user to accurately rotate and align the boxes. So user moves box A within range of box B, the closest faces are highlighted and then when mouse button is released they snap together with Box A translating automatically to align with Box B. I started by adapting the boxes at point of creation to contain subMeshes for each side. The intention here was to use the method above but instead of iterating through each box in my boxes array, was to iterate through each subMesh in each box in my array and apply the same logic to determine their distance. However the snag ... subMesh has no ".position" member so comparing currentBox.subMesh.position with boxes[j].subMesh[k].position does not work. I have a sinking feeling I am going to have to compare the sets of vertices that make up each face/side of each box. Not only is this more comparisons to perform on each move of the mouse and therefore a potential performance hit, but it also leads to some pretty complicated logic. In other words what is the criteria for nearest face .. I can't say "if the four vertices outlining a box side are all closes to the four vertices on a particular side of my currentBox" as if the box faces are not parallel you could find that the "nearest face" actually has some of its vertices that are further away from currentBox face than some other faces. I'll try and work up a quick playground to demonstrate what I mean but while I do, has anyone done this before? I cannot find anything on search her or google but it seems that it must have been thought about before? Thanks in advance, Richard
  10. I want to calculate a distance between object of the platformer and a place it can possibly achieve without moving up or down (face the obstacle or fall down), just left or right. So I use test bodies called this.shadowSide (to watch wall facing) and this.shadowDown (to watch falling). Prefer to call them "shadow bodies". I use this.game.physics.arcade.overlap to determine if the shadow body overlaps the floor. I move shadow bodies (left or right, depending of the direction I need), check overlaps and either continue searching or return a distance. It works well for sprite floors. The trouble is that this.game.physics.arcade.overlap doesn't seem to work with tilemaps. So I am looking for a way to indicate body vs. tilemap overlap. Or to calculate the distance in another way. Did anyone do that? The method with this.game.physics.arcade.overlap used with tilemap (left) and sprite floor (right): http://codepen.io/anon/pen/dPxbJw?editors=001 (use left and right cursor arrows to move bumpers and watch the distance change)The issue with body vs tilemap overlap: http://codepen.io/anon/pen/pvXGWR?editors=001 (I don't know whether or not it is an actual error)
  11. Hi guys, do you know what's the best solution for a well performed game with automatically increasing game score and distance like other endless scroller? I've two different ways tested. In reality, the code looks something different. I do not know memorize everything. The important part is the function calling. In update game loop or with different timer parallel... 1. - Update distance every time in game loop (update()). 60 times, every second, the player moves a few px. This is a value between 0.3 and > 2, depending on the game speed. - Update score every time in game loop (update()). 60 times, every second, the score increase. This value starts with 0, depending on distance and a multiplier. 2. - Update distance every time in game loop (update()). 60 times, every second, the player moves a few px. This is a value between 0.3 and > 2, depending on the game speed. - Save all in a distanceTotal variable - Built a interval timer (create()) with 500ms to check score and make data tween (600ms) for a nice counter animation. Update score depends on distanceTotal-oldDistance, to tween the correct new score value. I think number 2 is faster than the other, but i'm not sure. We dont have a score checking and updating 60 times per second. But a second parallel running timer 2 times per second and a tween for the count animation. There could be a problem with the total game score.... i update the score every 500ms, but what when game ends between the interval? In number 1 i dont need a tween, because the update is so fast. Are there better solutions or is this the correct way? I would be very happy for some hints. Regards, Chris
  12. Hei Phaser-Folks, finally I had to register and now I really would like starting asking questions I've been playing around with Phaser for like a month and came to a point today where I could need some help. Here is the problem: I have a checker board and two different groups of figures (let's say black and white). Now I want to check if any of those figures is surrounded by four other figures of the other group, like one black is surrounded by one white (left, right, up and down). Since I have them in a group I cannot do a simple distance check like if white.x - black.x < x1 do... I thought it is possible to use collision handlers using the "touching" property, but that does not work either. I can only check if they collide but not how many of those collide with one of the other group. So I don't know how to go on now and would appreciate any hint. Thanks in advance kogen.
  • Create New...