Jump to content

Select mesh edges and vertices on mouse over


Arte
 Share

Recommended Posts

:)  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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.  :)

Link to comment
Share on other sites

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:blink:

On my editor much more easier. :D

Link to comment
Share on other sites

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? 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

:)  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.  :D

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!  :D

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...