Arte Posted December 8, 2017 Share Posted December 8, 2017 Hi All, Do you have any idea how I can select edges/vertices on mouse over? http://www.babylonjs-playground.com/#35HAW1 I appreciate your time and effort to help me out. Arte JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 8, 2017 Share Posted December 8, 2017 You can rely on scene.pick. It will return a PickingInfo object : http://doc.babylonjs.com/classes/3.1/pickinginfo faceID property will give you the picked face. Then using pickedPoint you can determine which edge / vertices you want to highlight Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Author Share Posted December 8, 2017 Just beginning Face selected, vertices found! http://www.babylonjs-playground.com/#35HAW1#1 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 8, 2017 Share Posted December 8, 2017 looks good already! Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Author Share Posted December 8, 2017 A little bit messy, but vertices on my side. http://www.babylonjs-playground.com/#35HAW1#3 Next step edges! I hope someone will help me to improve Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 Gorgeous stuff! NOW perhaps... cylinderBetweenPoints (PG search for 'vend') That will work for edges, unless you feel like going indicesKind-grinding. Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Author Share Posted December 8, 2017 @Wingnut you are the "Live library from BJS forum" GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 thx. Sometimes foolishly. Sooooo... did you try to "derive" the 8-points... using only boundingInfo and boundingBox (and their properties)? What happened? Not enough code lines? (snicker) Just curious. You're probably going vert-dragging and edge-dragging, so you probably need to play in vert-land anyway. Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Author Share Posted December 8, 2017 I'm sweating on this Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 hehe... No pressure at all. I was MAYBE going to try a "derived from boundingBox" version... IF you haven't already tried one. I'm no pro with the boundingBox wrangling, but... it might be fun for a bit of afternoon pain. You have actual verts, so you could drag and bend junk. With a boundingBox-derived 8 spheres... it would be for... well... things OTHER THAN drag-plotting verts. Add-in our now-famous tri-grid 3D drag'n'drop, next? Maybe put your box in there, and when you light-up a sphere, put a round decal or disc on all three planes, each/any can be dragged? Huh? Let's go! heh Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 Ah heck, I tried a "balls from the bounding box" version... https://www.babylonjs-playground.com/#35HAW1#8 vertexData-free... but not near as much fun. How about some edges? https://www.babylonjs-playground.com/#35HAW1#9 It uses addEdge() which is almost identical-to cylinderBetweenPoints(). Goofy. Unfortunately, addEdge() screws-up the pivotPoints/origins on all the edges, and I think you would REALLY like all the edge origins to be dead center of each edge. hmm. aWeirdo and Arte 2 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Author Share Posted December 8, 2017 I like last one You options neater "shrug shrug" I'm done for today Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 Yours is more ready for dragging verts/edges, should you want-to. My bbx version is positionKind -stupid. You're going to stay rectangular, so, you would probably drag an entire quad/side/top/bottom... 4 points moving at once. Anyway, have a fine evening, and thanks for letting me play with your project. I hope I didn't ruin any fun for ya. Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 9, 2017 Author Share Posted December 9, 2017 More mess after box.setPivotPoint(new BABYLON.Vector3(-1,0,-1)); Sorry! In my project i'm setting and resetting pivotPoints. So i have to be sure it will work after setting or resetting pivot. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 9, 2017 Share Posted December 9, 2017 https://www.babylonjs-playground.com/#35HAW1#15 Notice lines 14-16... setPivot... but then bring the box back to original view-position. I've got quite an extreme pivot offset on there now, as you can see when I spin the box. Also, I needed to parent all spheres and edges/ridges... to the main box. But really, better to parent all ridges and spheres to an invisi-gizmo, and then every time you pivot-shift the main box, do the same to the "frame gizmo". Parent that gizmo to main box, as wanted. Just some thoughts.... not very exciting. There's some twin parenting loops in lines 156-161... a place to change box to frameDaddy (the invisi-gizmo) or something similar. Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 9, 2017 Author Share Posted December 9, 2017 Today i’m so tired to think about good things. I’m on my iPad and whis.. with ice c.... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 9, 2017 Share Posted December 9, 2017 Still need to think about picking... with the boundingBox-made version. Perhaps... hmm... when in "edit mode", start with 6 planes, exactly sized, on all sides of the box. Put actionManagers on them... sniffing for mouseovers or clicks or whatever. If picked, then add spheres and edges, IF WANTED. But do you need them, IF a user can pick a box side, and have it change color to show it is "selected"? I dunno. Just thinkin' of stupid stuff. When exiting edit-mode, you could fly all six of those temporary box-sides... off into space... a possible cool effect. What? Did you party last night? Look at ya! whis... with ice c...?? Whiskey and ice cream? No wonder ya feel like puppy stool. Quote Link to comment Share on other sites More sharing options...
Arte Posted December 9, 2017 Author Share Posted December 9, 2017 Each time on hover create or clone existing 8 spheres/box, delete on mouse out. How does it affect the performance? Today I helped move house. You know furniture disassembly........... move........ assembly On my editor much more easier. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 10, 2017 Share Posted December 10, 2017 ahh. Good ol' physical work. yech. The idea is... you never dispose/recreate. Just setEnabled(true/false) when needed, or use .visibility = 1/0. One complete frame exists all the time... just most parts are always invisible/disabled. You might need a frame re-sizer/re-scaler, though. Will you be needing more than one of these frames... active at the same time? Quote Link to comment Share on other sites More sharing options...
Arte Posted December 10, 2017 Author Share Posted December 10, 2017 “Will you be needing more than one of these frames... active at the same time? “ - No, just 1 face, 4 corners and 4 edges. Now I know what you mean (i’m bit slow today ). I’ll try tomorrow. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 10, 2017 Share Posted December 10, 2017 https://www.babylonjs-playground.com/#35HAW1#16 Just starting with a frame gizmo (central frame parent) and 6 panels, which will likely be invisible but they will be placed atop the box sides... and be the pointerOver/Enter sensors. Time for Wingy snowblow again, though. Currently working-on panel2 transforms [rot, poz, scaling]. Generally, 3 types of panels. FrontBack, LeftRight, TopBottom. Perhaps you might want to run-with this as a starter... while I wander-off for a couple hours. Your call. These sensor panels prepares us for 6 pointerEnter actionManagers, each with a special executeCodeAction. Example: If panel1 pointerEnter... make panel1 visible, along with spheres2, 3, 6, 7, and ridges 3, 4, 9, 11. On pointerOut/Exit... make all frame parts invisible again. These 6 invisible scaled-to-box-size panels... surround the box all the time (when box is in edit/whatever mode). Panel1 is scaled, rotated, and positioned already. Panel 2 is next. You'll want to AVOID panel.setEnabled(false) because that will disable the actionManagers on the panels. Make them visibility = 0/1 or material.alpha 0/1. The spheres/ridges can use setEnabled/disabled as wanted, unless you want to put actionManagers on THOSE for some reason. And again, I'm not sure that this is wise/not. Wingnut has a tendency to "take the long way home". You need not continue this... I will probably finish it no matter what, eventually... out of pure curiosity. ALL others are welcome to finish it, too, afaic. Be well, talk later. Arte 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 10, 2017 Share Posted December 10, 2017 On 8/12/2017 at 11:06 PM, Wingnut said: Ah heck, I tried a "balls from the bounding box" version... https://www.babylonjs-playground.com/#35HAW1#8 vertexData-free... but not near as much fun. How about some edges? https://www.babylonjs-playground.com/#35HAW1#9 It uses addEdge() which is almost identical-to cylinderBetweenPoints(). Goofy. Unfortunately, addEdge() screws-up the pivotPoints/origins on all the edges, and I think you would REALLY like all the edge origins to be dead center of each edge. hmm. #9 Looks like one of those music equipment boxes lol Wingnut and Arte 1 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 10, 2017 Share Posted December 10, 2017 Yeah it does. You work on stages sometimes, aW? Crazy way of life. https://www.babylonjs-playground.com/#35HAW1#20 Alright, we are rollin', now. What a pig. Functionally perfect... but I'm not sure if I have used enough code, yet. I bet the big dogs can do this same functionality... in 10 lines of code. heh Update: [#21] I made the panels all blue and gave everything a gray material... to look more like a road case (for mobile music/production gear, sometimes called an "Anvil Case"). I did not call hideFrame() at startup (although it will still hide on pointerOut). Then I thought... okay, just temporarily, I'll down-scale the gray box a bit, to beat the z-fighting on the panels (line 324). Hey, why doesn't this work? Well ya dummy Wingnut, the "frame" is "derived"-from current box scaling. SO... down-scaling the gray box... just makes the frame parts down-scale, too. DUH! var n = .001; // nudgie Lines 205-225... need some "nudgies"... little bumps of the positioning values... to kill the z-farting. I suppose a guy could "thicken" the panels... by making them be thin boxes, instead of planes. Maybe that would be easier. The best way... would be an aerosol can of spray-on "Z-Peace". But noooo... they quit making that 2 years ago. hrmph. Nudgies installed: https://www.babylonjs-playground.com/#35HAW1#23 yay! GameMonetize, JackFalcon and Arte 2 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted December 10, 2017 Author Share Posted December 10, 2017 Next time I will explain what I need and you will do the rest Party. Thank you Wingnut. I will take care of this tomorrow. (Christmas preparation) Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 10, 2017 Share Posted December 10, 2017 I had good fun. I was doing heavy drugs the whole time. This kind of thing has re-usability, too. Others will likely borrow it and sell it on the streets, for heavy drugs. heh Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.