Jump to content

Search the Community

Showing results for tags 'picking'.

  • 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
    • Babylon.js
    • 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 24 results

  1. Hi there, learning Babylon.js since 2 days I've created a "container" mesh (with no geometry), and then added to it 2 children meshes, a box and a sphere. I would like to pick the container mesh on mouseClick event, but actually either box or sphere get selected. Is there a way to ignore submeshes? I know there would be many workarounds, like for example creating the container as a box with a transparent material, but I was just wondering if there was a flag/parameter a can set when doing raycasting. Here you can find the PG: https://www.babylonjs-playground.com/#BD4L6U
  2. Hi, Is there anyway to pick a bounding box? I know I can pick a mesh using scene.pick but then pickInfo.pickedPoint will give me the point where the picking ray hit the mesh. What I would like to get is the point where the picking ray hit the bounding box of the mesh. How can I do that? Thanks!
  3. Hey guys... while refactoring some code, I ran off down the path of changing my old picking method (Raycasting, etc) to use actions... specifically OnPickTrigger with ExecuteCodeAction. But... I was a bit confused when I could not find the picked point on the mesh in the event data. Am I missing something?
  4. Hi guys I just started getting into BabylonJS and I really like the simplicity of it, is elegant I have a question about how low level can I get with Babylon, I want to make a 3D modeling application, similar to what Clara.io is doing I know they are doing it in Three.js and I did a first prototype with three.js but I'm not happy, it got really messy really quick. So a few things I would was to do is, selecting individual vertices of a mesh, selecting faces and edges creating geometry on the fly, for making tools to extrude faces etc. also support for quads in meshes not just triangles I realize most of this stuff I have to develop my self but is more of a technical question of, can I go there? is that level of control exposed via BabylonJS? Really appreciate any help you can give me on any of this subject Thanks a lot
  5. Hi Folks, I wrote a small selection effect like in the playground http://www.babylonjs-playground.com/#2EHGYF#7. Actually I add cloned meshes on top of the originals. This seems to work perfectly but every time I select, unselect a mesh, I need to update the Octree. I am working on a similar effect on highlighting when the hover the mouse on the meshes. I am not sure if the performance can be OK with large models. Is there any way to handle this? I mean maybe I can have another scene or...the Octree can be applied only on the main scene? Many thanks
  6. Hi Guys, I am doing selection by adding a pointer observer like below. But there is one thing that this can not work which is clearing the selection(s) when clicking on the "empty" place. I know that I can add an observer with POINTERDOWN(or POINTERUP), but what I wish is when I rotate the camera by left click + dragging, the "selection event" will not be triggered. Only when I click at the empty place without rotating the camera, the selection will be cleared. How can I do this though? addPickingObserver(observer: (eventData: BABYLON.PointerInfo, eventState: BABYLON.EventState) => void): void { this._scene.onPointerObservable.add(observer, BABYLON.PointerEventTypes.POINTERPICK); } private createDefaultPicker(): void { let observer = (eventData: BABYLON.PointerInfo, eventState: BABYLON.EventState) => { this._selector.clearSelections(); if (eventData.pickInfo.hit) { let renderModel = this._renderScene.getRenderModel(eventData.pickInfo.pickedMesh); let selection = new Selection(new PickingInfoEx(eventData.pickInfo, renderModel)); this._selector.addSelection(selection); } } this._renderScene.addPickingObserver(observer); }
  7. Hi everybody: I have a doubt on registered Actions, is possible to retrieve the pickedPoint from the callback parameter? I mean something like we have with Observables via the "d" param (d.pickInfo.pickePoint), in order to avoid to implement always the pick-result-check as shown in the following code (excerpt): myMesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger,function(evt){ var pickResult=scene.pick(scene.pointerX,scene.pointerY); if(pickResult.hit){ ... } })); Best regards.
  8. Is it possible to pick hidden objects in a scene? If so, how is this achieved? Thanks in advance
  9. I just found out that picking with fastcheck set to true doesn't work as expected. It won't give you the closest mesh but the one added to the scene first! The problem is inside _internalPick function. I added a comment where it literally breaks the search for the closest hit. private _internalPick(rayFunction: (world: Matrix) => Ray, predicate: (mesh: AbstractMesh) => boolean, fastCheck?: boolean): PickingInfo { var pickingInfo = null; for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) { var mesh = this.meshes[meshIndex]; if (predicate) { if (!predicate(mesh)) { continue; } } else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) { continue; } var world = mesh.getWorldMatrix(); var ray = rayFunction(world); var result = mesh.intersects(ray, fastCheck); if (!result || !result.hit) continue; if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) continue; pickingInfo = result; // This breaks the search for the closest hit when anything is hit. if (fastCheck) { break; } } Or is this actually intended @Deltakosh?
  10. Hi Everybody! So I have some hotspots floating around in z space. Each hotspot isPickable = true and each non pickable mesh isPickable = false. When I test on desktop it runs like a dream, but when I test it on mobile devices, the hotspots don't respond to any touch actions/click. Babylon version is v 2.5.0 I created a PG. The PG works great on desktop and mobile, but the PG is running version 2.6 alpha Is this something that was adjusted? Am I missing something? Can I change what version of Babylon being used in the PG so I can have a more accurate test? PG: http://babylonjs-playground.com/#PEJDE#8
  11. Hi, I already replied to @faljses post in bugs section (link below) but I'm not sure this really is a bug so I'll try and ask here too if anyone knows a way to do this. So, I'm trying to use picking with an orthographic camera. My picking code works as long as I use a camera in mode=0 but in orthographic mode it never hits anything. Here is faljses playground example that shows that as soon as you change the camera mode to 1, the picking stops working. http://www.babylonjs-playground.com/#XUDHE I already searched the source for some hours by now to see if I can spot a bug but didn't find one. I suspect that what ever goes wrong (bug or me using the framework wrong) has to do with the cameras projection matrix. In my own code I use Scene.pick to get my picking information but I suspect, that the problem I experience is the same as the one we see in the Playground, thus I'd like to focus on the Playground first for convenience. I appreciate any hints I can get, as I need to get this working, so if you have an idea what might go wrong here please tell me. faljses post in Bugs section:
  12. Hi, I noticed picking doesnt work correctly when using an orthographic camera. I could reproduce the problem modifying your samples on playground: http://www.babylonjs-playground.com/#XUDHE Result is always false: {hit: false, distance: 0, pickedPoint: null, pickedMesh: null, bu: 0…} Is this supposed to work, or do i need to use a different method for ortho projection? faljse
  13. hullo guys, how's your shopping goingA? I need help with picking mesh in imported 3D scene, i've tried some codes but it's not working
  14. Hi! So I'm ultimately trying to pick some meshes with textures that have transparency, but when they overlap, the transparent parts of the mesh still get picked. Playground: http://www.babylonjs-playground.com/#1UCP5L If you open up the console in the playground and click the 2 black circles in the center of the overlapping "impact" textures, you'll notice that it always picks the 1st texture (although you're clicking on 2 separate "visible" textures if you take transparency into account). I thought perhaps I could test to see if the texture color at the UV coordinates of the picked mesh is transparent, and if it was, I could temporarily mark that mesh as not pickable and pick again at the same location to get the mesh under it until I got something that isn't transparent (and then restore the isPickable state of everything). I still think that could work (although it seems terribly inefficient as I have to do several picks unnecessarily), but I frustratingly can't actually find a good way to get the texture color given the texture and some UV indices (obtained through the pickedInfo). Am I just missing something obvious? Is there not simply an analogous textureObject.getTextureColorAtUV(u, v) function? I'm also open to other suggestions to get more accurate picking with transparency taken into account. Thanks so much! Zack
  15. Hi guys, I have a problem with mesh picking and it is a specific case. When I create a ribbon like this, I can see it on the scene: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); On mouse down I am writing the name of the picked mesh in the log: handleMouseDown: function(event){ var pickResult = _scene.pick(_scene.pointerX, _scene.pointerY); var pickedPoint = pickResult.pickedPoint; console.log(pickResult.pickedMesh.name); // writes ribb when I click on it } BUT, when I update the ribbon mesh after creation, like this: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); someRibbon = BABYLON.Mesh.CreateRibbon(null, [[new BABYLON.Vector3(0, 0, 5), new BABYLON.Vector3(10, 0, 5)], [new BABYLON.Vector3(0, 10, 5), new BABYLON.Vector3(10, 10, 5)]], null, null, null, null, null, null, someRibbon); Then I can see that the ribbon that is updated (moved 5units along z axis), but it can't be picked. Actually, the picker "thinks" that the ribbon is still in the old position. Does someone have any idea how this could be solved?
  16. Hi, I have some meshes, created with PolygonMeshBuilder. They're not overlapping, but their bounding boxes are as you can see in the attached screenshot. I want to achieve pixel perfect picking for those. Using scene.pick without fastcheck for some reason still picks those meshes by bounding box. (In the attached screenshot - the green mesh is getting picked instead of the purple one) Any ideas? Thanks
  17. Hey guys, When you add actions to a mesh's instances, it affects the parent mesh and every instances. I'm not sure that's the behaviour you want, am I right ? You can see it in this playground : http://www.babylonjs-playground.com/#HZTM8 Thank you
  18. Hi, I don't know if you could really call this a bug or maybe it's working as intended and I'm doing it wrong... (sorry) If you get sufficiently close and intimate with a mesh you can't pick it. Here's a playground: http://www.babylonjs-playground.com/#1KNCOA The important parameter to look at is the Z coordinate of the camera. If I set it to -1.06 then I can successfully pick the front face of the box and distance to the box is 0.01. (I'm printing pickResult in the console) If I set it to -1.04 then I can only pick the back face of the box yet I can still see the front face. If I set it to more than -1 then I can't see the box so I can't pick it, that's normal. It's as If the ray's origin wasn't exacly in the camera's viewframe but 1 unit length in front of it.
  19. Whoa! Okay, there are two parts to this. Case/Issue 1: Scene picking info for animated rigs only obtains picking information from the first frame of the rig animation. I've setup a test case, http://jsfiddle.net/7x0nkh0g/3/ , where there's this cube that is being animated and moved by this bone. You can click on the cube to change it's colour between green and red. Clicking only works if you click on the mesh where it was at the first frame of animation. Doesn't canvas picking info casts a ray into the scene and looks for active faces everytime? It appears that it's using the first frame of the rig as if it was not being animated at all. This issue occurs from files exported from both Babylon and Tower Of Babel exporter from blender. Case/Issue 2: Using the Morph Extension (ver 1.1) and Tower Of Babel to import and animate shape keys created in Blender, on a mesh that also has skeletal rig and animation, morph shape offsets are relative towards the Rest Position (edit mesh position in Blender before the mesh has been set to a pose by a rig). Using the previous jsFiddle example: http://jsfiddle.net/7x0nkh0g/3/, clicking on the blue circle morph's the cube's shape into a pyramid. Only the top four keys are morphed. Notice how the top four keys try to move towards the rest position of the original mesh instead of following the translated skeletal rig's first frame. After discovering this, I created another animation rig but this time, I set the first frame of the rig to match the original rest position of the mesh and then have my usual looping animation after that. In Babylon, I then set the rig animation to skip over that first frame. This is sort of a work-around but it actually works! See: http://jsfiddle.net/7x0nkh0g/4/ The cube is being morphed to a pyramid correctly now, while still being animated by a skeletal rig. I've only tried this trick out on the test case. Can't wait to try it out on my facial shapes on top of a skeletal animation. I read in some old threads that JCPalmer might have a working copy of the Morph Extension version 1.2 hasn't been released? I'm getting depreciation messages from BJS using this old Morph Extension: "BJS - [22:36:45]: Mesh.updateVerticesDataDirectly deprecated since 2.3." On a sidenote for those test cases I've created, if you click on the blue circle to morph the shape of the cube first, then you can't click on it to change it's colour later. JS gives an error "Uncaught TypeError: Cannot read property 'subtractToRef' of undefined". Click on the cube to change its colour first and then clicking the morph next works fine however. If you need the blender file, I've attached it. cubearmatureplusdeform.zip
  20. I am using the virtual joystic camera to move around in my scene for users who are using ipads. The VJS camera works perfectly, but how do I allow users to pick objects in the scene? is there a way to keep the joysticks fixed on the bottom of the screen and allow the user to still pick objects?
  21. I'm trying to pick this big gray sphere, picking works, but actually in strange way. It really works even I'm clicking out of sphere shape, and sometimes doesn't work while clicking on the sphere shape. What is a collider here? I've tried to draw bounding boxes, expecting to see how colliders look, but it's not connected.
  22. I working on my first game in Phaser, a pirate baking sim, where the player controls two hands using mouse and keyboard and interacts with items on the kitchen bench. BUT I got stuck on a specific problem: I would like to be able to find a point under the 'hands' of the arms, so that I can use that to add items in the correct place in the gameworld, and I want to use the same point to identify what is under the 'hands', so that the user can interact with and pickup items. The x and y coordinates of righthand.getBounds() are close to correct, but I suspect that is not the correct approach. The arms are currently just plain sprites, fixed to the camera and anchored to rotate around the bottom center edge. // right armthis.rightHand = this.handsGroup.create( 1074, 800, 'righthand' );this.rightHand.scale.set(0.75 , 0.75 );this.rightHand.anchor.setTo(0.5, 1.0);this.rightHand.frame = 0;this.rightHand.rotation = this.arms.rotR;this.rightHand.fixedToCamera = true;Is there is an easy solution or am I modelling my game incorrectly? The (unfinished) pirate baking game with graphics, music. hookhands etc is here: http://gamejolt.com/games/strategy-sim/arrrr-pirate-baking/64428/ I've attached a zip file with a cut down version of the code (feel free to use it to make yer own pirate arm waving game, arrrr! The attached code omits the heaving bench and sliding objects. Thanks, Marcel armpicker-phaser.zip
  23. Hey ho, another two quick (and hopefully easy) question, please have a look here: http://www.babylonjs-playground.com/#GQDHN 1) I am trying to create a tiles ground with 4 submeshes. I start with zero submeshes. I am pushing submeshes 4 times... I end up with 8 submeshes... ... ... eh? I feel like I am missing something here, please tell me what's going on. I assume the 8 submeshes are the triangles that I see in the wireframe... but why? 2) How can I pick a submesh? The scene.pick returns the clicked mesh, but how would I determine the submesh at the clicked position? (Edit: I searched and didn't find anything about picking a submesh at all, but somebody must have done that before, I think. Maybe it's too easy so nobody else ever asked :-/ ) Easy questions, right? Enlighten me please!
  24. Hi Blender Community We have a problem with picking a mesh, i.e. selecting the desired object, and the rendering of certain elements. We have a .3DS file with our design which was originally created by Revit 2014. Since there is no exporter we installed the exporters for Blender version 2.73a and 3D Studio Max 2015. When importing the .3DS file into blender and back to .babylon I am able to successfully select the object via an EventListener by interrogating the PickResult. If we export this same file via 3D Studio Max I am not able to select the active mesh. The pickResult.pickedMesh returns null. I am able to set collisions successfully with both exported files. Is there some setting or something that we need to do to get the 3D Studio Max Exported Version to export a clickable mesh like blender does? In our design there are certain elements which are missing when rendering the object. Or object contains 4 racks, but only the bottom 2 displays. The bottom one is different from the one above. The top one is duplicated in the design as it is the same object and we believe this is why the duplicates are not showing. What can we adjust in the design to make them show?
  • Create New...