Jump to content

C̶o̶l̶l̶i̶s̶i̶o̶n̶ ̶/̶ ̶g̶i̶z̶m̶o̶ Snapping


babbleon
 Share

Recommended Posts

Hello all,

I feel as though I'm being hard of thinking here.

Here's a PG: http://www.babylonjs-playground.com/#3ENM44#1

How do I make any one of the boxes stop moving when it hits another? I have got as far as it logging to the console when the ellipsoids collide - not what i want though.

This needs to be accurate to .001 scene units (a millimetre for my setup).

Think I'm going about this the wrong way. Importantly, I need to get this working with the gizmo.

Any help would be much appreciated.

Thank you.

Link to comment
Share on other sites

heh.  Yeah, I actually INVENTED the stuck-together-when-collide-too-fast feature.  :D

I've had some lame ideas... about how to fix this.  Mainly, reverse gear.  We could record ALL the "previousPositions" that happen during the drag.  Then, upon collision, repeatedly check intersectsMesh()... and keep reversing the drag... until intersectsMesh goes false.  Pain in the butt, but might work. 

The real fix... is at core level... preventing the overlap/stuck condition from happening.  Might be a good team project, if anyone can manage to get a team together.  Should we go core-diving and see what we can screw-up?  :)  As you know by reading forum archives, this has been a long-time issue.

As you might ALSO know, the BJS built-in ellipsoid collision system... was not designed/intended for mesh-to-mesh collision... only for camera-to-mesh.  *shrug*  We won't let that keep us from hacking/experimenting, though, right?  :)

Link to comment
Share on other sites

Hey @Wingnut,

I think that as I'm mainly going to be dealing with boxes, that when one box gets close to another it just snaps to it... The reason being this has to be dead accurate.

I can use extremities of boundingbox and determine which to snap to (any one of the min/max, x/z can snap to any of the min/max, x/z of the other mesh), though this solution would be fairly specific to me and not necessarily to others.

 

Link to comment
Share on other sites

  • babbleon changed the title to C̶o̶l̶l̶i̶s̶i̶o̶n̶ ̶/̶ ̶g̶i̶z̶m̶o̶ Snapping

It seems to work for me... at least somewhat.  Firefox ESR.  Earlier, I thought it needed alt-dragging, but I think I was wrong about that.

Standard-click any mesh to turn it yellow.  It must be yellow before you click again and start dragging. 

When the dragged item is in a position where it can be dropped, a green proxy box will activate at the snap-to position.  Then release the dragging, and the selected box will move to green proxy box position... and stay yellow/selected (green proxy box will disappear).

Also, I think it can only be snapped-to a position where it is not overlapping another box.

Any errors at the console, guys?

 

Link to comment
Share on other sites

If I click on a box, it just highlights it, and if i then drag mouse with mouse down, it only moves the camera. No errors.

Chrome 66.0.3359.181, Firefox 60.0.2 on Linux and fairly recent Chrome on Win 10. 

Ooh, it works on Epiphany (WebKit) 3.28.3.1 on Linux

Edited by babbleon
working browser
Link to comment
Share on other sites

Hi guys!

Selected mesh needs an elevator system, both upward and downward, eh?  U/D keys.  :) The amount of Y-axis ground/selectedMesh change... could be based upon the height of the nearest non-dragged mesh (the snap-to destination mesh)  (actually, its extendsTo or similar).  I've only had a half-cup of coffee so far, so I could be blurry, still.  More blurry than normal.

 

Link to comment
Share on other sites

Not sure if either of you use Blender, but their edit mode snapping (active) is great as it enables you to choose the point that snaps onto another (a bit like my mostly functioning PG).

@Arte, as regards the snap offset... would this be from user input or preset? I vaguely recall seeing a demo of your cabinet designer and there was a snap button, next to it you could have offset; x, y & z.

 

Link to comment
Share on other sites

*nod*  Sometimes, the primary objective... is to drive it all with the keyboard and not need the mouse.  This allows things like voxel constructions... to be built very fast.  All your offsets are probably... 25%/50%/75%... and you can almost "type" a construction just like you would a sentence.  Not sure if that is sought... but if it IS, that opens-up many hot keys and easy-buttons.

Even things like... keep hitting control - [ & ] ...until the snap is positioned as wanted.  (Keypresses cycle-thru all the possible snap-to scenarios until user finds one that user likes).

Any thoughts about activating entire keyboard?

Link to comment
Share on other sites

2 minutes ago, Wingnut said:

Keypresses cycle-thru all the possible snap-to scenarios until you find one that user likes

Sounds good to me, but not for tablet/Ipad users :huh:

I need coffee to with pipe :)

Link to comment
Share on other sites

 

4 minutes ago, Arte said:

with pipe

With pipe?  Now what kind of pipe would that be?  :)

Surprised me, because i am both a tobacco pipe smoker, and... umm... other things too, sometimes.  But, I've been a tobacco pipe smoker for... ever.  You, Arte?

Sorry for off-topic.  :)

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