Jump to content

Search the Community

Showing results for tags 'pick'.

  • 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. Refer to the link below, for billboard enabled meshes, I added mouse pick event so the camera will target to the mesh which being clicked. However, after click on the mesh which BILLBOARDMODE_ALL is enabled, I got the following error. I'd be really appreciated if anyone can fix this issue. Thanks. https://www.babylonjs-playground.com/#9XBPW4#2 if (!m.actionManager){ m.actionManager = new BABYLON.ActionManager(scene); } var act = new BABYLON.ExecuteCodeAction( BABYLON.ActionManager.OnPickTrigger, pick ); m.actionManager.registerAction(act); function pick(evt){ var mesh = evt.meshUnderPointer; camera.setTarget(mesh); }
  2. Refer to the playground url below, sprite is in front of the sphere, however the click / pick event triggered on backend sphere first regardless of the sprite's position. Url: https://www.babylonjs-playground.com/#9RUHH#29 Expected result: Player clicked will be triggered instead of Sphere clicked.
  3. I'm able to pick sprites with Scene.pickSprite, but is there a way to pick them with scene.pickWithRay? PickWithRay only seems to return meshes (I've set isPickable to true on the sprites and confirmed that they're pickable with Scene.pickSprite). The use-case is, I'm trying to pick sprites with a 3DoF VR Controller, so I don't have a 2d pointerX and pointerY to work with, only the controller's forward ray. I'm thinking that my options are: a. Use Vector3.Project to try to unproject the pickedPoint of pickWithRay (I'm using a skybox, so the ray will always hit something), then put that point into Scene.pickSprite. I tried this quickly, but I think the unprojected point might be off b. replace the sprites with billboarded mesh instances that can directly be hit with pickWithRay. I suspect this might be the easiest option? Or is there some easier way to pick a sprite with a ray?
  4. [>PG](http://playground.babylonjs.com/#TGNTGT#39) All faces are created by polyhedron. And may anyone tell me what made it so hard to pick faces top-down? It works if you rotate the meshes and pick from downside, but how can I pick the top face in this way ?
  5. Hello, As far as I understand ray picking shouldn't depend on bounding box. But, when I change mesh's bounding box for some reason it affects picking. Playground that reproduces this behavior I would expect both spheres picking to act the same. Tomer.
  6. Hi, downloaded news dist folder from master branch and now scene.pick is broken for me: // prefix is RegEx const predicate = (currentMesh) => prefix.test(currentMesh.name) && currentMesh.isPickable; const pick = scene.pick(scene.pointerX, scene.pointerY, predicate); It finds objects but in mirror so to pick object that is lets say in top of screen are clickable in same position but bottom of screen. Works fine with newest beta version on npm. Any ideas ? I will try to dig into code as I saw that pick was changed recently.
  7. I set the mesh renderingGroupId attribute, but the view of the pick will still be blocked by the mesh. When a mesh covers the camera.
  8. Hi I have a scene with sprites which can be picked, but picking doesn't work Here is playground of my scene: https://www.babylonjs-playground.com/#8AH0JV#5
  9. Hi do I need to include pep library for picking? I added click event bit saw that scene has pointer coardinates window.addEventListener("click", function () { var pickResult = scene.pick(scene.pointerX, scene.pointerY); })
  10. I've exported my scene from 3Dsmax. Now I want to get individual meshes and want to do something with them. How can I select a mesh in the scene? with its name or ID... ?
  11. Adem


    There's a bug in picking mesh in imported 3D scene
  12. I'm looking for the depth information (per pixel) of a camera's view on the scene: distance position: x,y,z Currently I'm using the scene pick functionality for each pixel: for x = 0 to maxX for y = 0 to maxY scene.pick(x,y,null,false,camera) Then use the returned PickingInfo's distance and pickedPoint. Is there a better/faster way to get the depth information, because the above mentioned code takes several seconds. Maybe via a shader?
  13. Hi, all! I am trying posting questions not so often, but sometimes it is very need and I have to do it. I want to know a picking point of a mesh with playing an animation. But when I am using scene.pick or pickWithRay - it is function does picking relative a first frame of animation of a mesh, but my mesh it is a runing man and hands and legs and different parts of body every frame in different positions. How I can do this? Pick a mesh relative of current frame of animation. Thank! To be precise I want to know pickedPoint.getTextureCoordinations.
  14. Hi guys, Could anyone kindly shows me a little bit of code about pick and paint color to the sprite? here is my code that I have played around, but I still cannot find out and achieve it. Thanks you in advance for your time and consideration. preload: function() { this.game.load.image('test', 'test.png'); }, create: function() { this.color1 = this.drawRec('rgb(141,243,160)', 20, 20); this.color2 = this.drawRec('#6bd4e0', 100, 20); this.color3 = this.drawRec('#cb6be0', 20, 100); this.color4 = this.drawRec('#8df3a0', 100, 100); this.square = this.game.make.bitmapData(); this.square.load('test'); this.square.addToWorld(this.game.world.centerX, this.game.world.centerY, 0.5, 0.5); this.game.input.onDown.add(this.pickColor, this); }, drawRec: function(color, x, y) { this.bmd = this.game.make.bitmapData(100, 100); this.bmd.ctx.beginPath(); this.bmd.ctx.rect(0,0,50,50); this.bmd.ctx.fillStyle = color; this.bmd.ctx.fill(); this.sprite = this.game.add.sprite(x, y, this.bmd); }, pickColor: function(pointer, x, y) { console.log(this.bmd.getPixelRGB(x,y)); }
  15. I would like to si ArcCamera to have plugin for virtual joystick for rotation. Or optional feature to joystick for move forward backward (which could be enabled or disabled) But joystick for rotation will be fine to see. I have some example how arccamera follow ball. I create my own joystick for rotation only (without forward and backward..... options!) (and posibility for forward/backward/left/right joystick which we could attach 3d calulation of object in center of arccamera) Can anybody add feature for arcCamera rotation pick/touch joystick like VirtualJoysticksCamera have it on the right side? Maybe you should inharid arcCamera and create ArcVirutalJoystickCamera. Have anybody any opinion. Maby babylon.js should add this feature in new release. Greetings
  16. 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.
  17. Hello, i would like to create a selector like this : http://threejs.org/examples/#webgl_interactive_voxelpainter (I know it's three.js but I don't find it with babylon) My goal is to allow the user to create a cube at the cursor position. I manage to move the red mesh which represent the cursor but i don't know how to detect the collision and stop the movement of the mesh. I tried to use moveWithCollisions but it don't work well when i move fast the pointer. Do you have an issue ? Thank you in advance
  18. Hi, I have this as of now : http://www.babylonjs-playground.com/#SWSKU#3 in which I can pick a mesh, drag to other place and drop. Is there a way to select more than one mesh at the same time and do the drag drop operation ? Thank you
  19. Hi everyone, i'm a newbie playing with Babylon.js, so be nice. haha I already saw a lot of picking meshes codes, onmousehover, onmouseout and stuff, but I wanted to use it in a loaded mesh. Especifically an .obj file. I have a 3DS exported file with a lot of shapes, and I've already achieved some part of my objective using the code below, that returns me the name of my shape(nice!). window.addEventListener("click", function () { var pickResult = scene.pick(scene.pointerX, scene.pointerY); console.log(pickResult.pickedMesh.id); }); Now I want some hover and selected effect, but I haven't seen something like that on the internet. I've tried to implement raanan's suggestion with jquery, but i wasn't successful. What can i do? Thanks in advance
  20. linemesh has the isPickable property. But I haven't been able to pick it. Is this even possible? Regards
  21. Im trying to do a hit test on a skinny mesh, so i want the meshes hit box area to be bigger than the actual mesh so that its more user friendly. I have tried to make its bounding box bigger, but that doesn't work. Is there a way to do a hit test on the bounding box area? Example of what i am trying to accomplish that doesn't work. http://www.babylonjs-playground.com/#EAR83 Also instead of using action manager i have tried just doing a hit test every fram using jquery and scene.pick. This also doesn't use the bounding box info. Coded as such: $('#canvas').mousemove(function(evt) { var pickInfo = Editor.scene.pick(Editor.scene.pointerX, Editor.scene.pointerY); if (pickInfo.hit) { console.log(pickInfo.pickedMesh.name); } });Any help would be appriciated. Thanks.
  22. Hey guys, To boost a performance on mobile devices with Full HD screen resolution I'm doing the following thing: 1. Set canvas size like half of full screen 2. Scale the canvas with CSS As a result, the GPU has to do less work, and the scene runs smoothly. Here is the example css: #canvas { position: absolute; width: 40%; height: 40%; -webkit-transform: scale3d(2.5, 2.5, 1.0); transform: scale3d(2.5, 2.5, 1.0); -webkit-transform-origin: 0 0 0; transform-origin: 0 0 0; top: 0; margin-bottom: 70px; touch-action: none; -ms-touch-action: none; z-index: 0;}Well, this approach worked until I started dealing with picking collisions. The picking mechanism doesn't take in account the scaling. Therefore the pick result is completely wrong. If you run this code without scaling it would work as expected (if you pick sphere, it would write in the console "sphere1"): var createScene = function () { // This creates a basic Babylon Scene object (non-mesh) var scene = new BABYLON.Scene(engine); // Our built-in 'sphere' shape. Params: name, subdivs, size, scene var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 3, scene, false); sphere.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(Math.PI / 2, -Math.PI/2, 0); var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 50, -10), scene); var light = new BABYLON.DirectionalLight("dir1", new BABYLON.Vector3(0, -1, 0), scene); light.position = new BABYLON.Vector3(0, 30, 0); sphere.position = new BABYLON.Vector3(0,1.5,0); camera.target = sphere.position; camera.setTarget(sphere.position); camera.attachControl(canvas, true); scene.onPointerDown = function (evt, pickResult) { console.log("Picked " + pickResult.pickedMesh.name + " in x:" + pickResult.pickedPoint.x + " y:" + pickResult.pickedPoint.y + " z:" + pickResult.pickedPoint.z); } return scene;};But if you run it with the above css, it wouldn't work, i.e. picking sphere would give you a null result. Anyone has any idea how to deal with this?
  23. Hello guys, I'm doing an app to control objects via a Kinect sensor. I finally managed to control two hands (they are just images) on the screen, and the next step is to be able to put a Hand in front of a sphere and allow this sphere to follow the position of the hand. My hand is just an Image on the screen I move it by changing his left and top css properties, and my problem is how to know when my hand "touched" the sphere. I've tried with BABYLON.Ray(hand.x,hand.y) but it's like the ray is pointing somewhere I don't know, and the "touch" occurs somewhere far from the sphere. Any ideas ? Thank you in advance.
  24. Hello ! I'm wondering what would be the best way to have pickable objects (with Physics.P2) ? I mean, I wan't to be able to interact with this item by its body but without it to be blocking me. The scenario would be: I have a Player class, a Pickable class (a coin). Once the player's body touches the coin's body it fires an event (like onBeginContact) but never blocks me. It looks possible with: -Sprite.overlap (but not accurate at all) -Solid bodies and body.onBeginContact(...) then I immediatly clearShapes (but it's not clean, and the player will still be stuck 1 frame) ... Thank you :-) !
  • Create New...