Jump to content

Action on border click/drag


Recommended Posts

Hi M.  Sorry for slow replies.  You ask a tough question.

No matter the shape... torus knot, whatever... you will probably be working with the mesh.getBoundingInfo().boundingBox.

So... when you say "based on vertex picked"... can we change that to "based upon what part of boundingBox is picked/dragged"?

Would that be okay?  If so, you STILL have plenty of hell ahead.  :)

My opinion: I would create my own bounding box... from elongated pickable boxes.  Essentially, make your own boundingbox wireframe (a wireframe-o-boxes - I'm thinkin' 20 boxes. 12 edges & 8 corners).  Each wire-edge and each corner... is clickable.  Perhaps later, drag-able.

You could use a func called showMyEditableBoundingBoxWidget()  :)  It turns-on your "20-box thing"... which is built/sized based-upon mesh.getBoundingInfo() values that you can query.  (You can make your "thing"-box... be the exact size as official BJS boundingBox.) 

You could also have a "switch" on your thing... for changing "thing modes".  One mode for sizing, one for positioning, one for rotating.  You could change the style/colors of your "thing"... based-upon which mode the user has chosen.

That's what I would do.  Get full control... by building your own multi-click-drag-point "widget". 

Keep in mind... that our current drag'n'drop demo in the playground... requires that a ground be positioned "behind" ALL drag-able points.  If the ground is NOT behind the point of dragging, the drag won't work.  This is because of the getGroundPosition() func.  It is used to provide a diff in onPointerMove() - line 112.

Sooo... MisterDon... you must use proper camera angles and ensure your "thing"-box is not too tall. 

Example: Perhaps you will want to allow user to drag on upper left corner of your thing-box.  If no ground is behind that drag-point, it won't drag.  OH NO! 

You might need to "force-adjust" the camera/view... whenever you turn-on your super-adjusting "thing".  Don't allow ANY drag-point on your thing gizmo... to have no ground behind it.

Also, you may need "axes constraint keys".  Control-drag for X-only movement.  Shift-drag for Z-only, etc.  Alt-drag for Y movement.  Y-drag movement is the most difficult... because ground plane (where drag-diff is derived) is x/z.  It takes a bit of trickery.  :)  For most accuracy, also allow "snap".  For example, the diff value is often distorted... inaccurate... when doing a Y-drag.  You might wish to do Y movements in steps of 1 unit.  Or steps of 0.5, etc.  Y is the most difficult to make accurate.

What happens... dragged points that are CLOSE-TO the camera... move Y slow/low amounts (small diff values per pointer distance-move).  When drag points are higher-up on your thing, ground diff can change LARGE amounts with only tiny mouse moves... making Y-drags fast/large. 

If you're "hot", you can build a calibrator.  Slow down (de-sensitize) the Y-drags... when ground-point of click is far from camera. :)

I hope you understand all that, because I barely do. Just keep in mind that the camera viewing-angle in our drag'n'drop demo... is very important.  SO is the size of the ground.  Move camera down to perfect ground level, and drags will completely fail.  No ground behind drag points.

Okay, cya later.  Hope this helps.  Others will surely comment... soon.  Darned good question, Masterdon.  You make me have to think.  heh.  Ouch. 

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.

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.


  • Recently Browsing   0 members

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