babbleon Posted July 10, 2018 Share Posted July 10, 2018 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. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 10, 2018 Share Posted July 10, 2018 Hello, Just an idea, maybe you can disable collisions when you use gizmo and reactivate them when you do not use it anymore. Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 10, 2018 Author Share Posted July 10, 2018 Thank you @Dad72, if I disable collisions when I use gizmo, how can I detect when I'm hitting another mesh? This is the first time I'm using collisions, so I'm maybe going about this the wrong way. Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 10, 2018 Author Share Posted July 10, 2018 Okay, this works better: http://www.babylonjs-playground.com/#3ENM44#2 ...but if you drag quickly the meshes intersect. I think snapping maybe the way to go... @Wingnut seems to like these sort of things! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 10, 2018 Share Posted July 10, 2018 heh. Yeah, I actually INVENTED the stuck-together-when-collide-too-fast feature. 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? :) Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 10, 2018 Author Share Posted July 10, 2018 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 10, 2018 Share Posted July 10, 2018 *nod* https://www.babylonjs-playground.com/#HHFBT#2 There's a grid-drag-snap. (yawn) Also... umm... http://www.html5gamedevs.com/topic/20751-aabb-snapping-in-3d/ *shrug* Party on! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 10, 2018 Author Share Posted July 10, 2018 This is starting to get somwehere.... http://www.babylonjs-playground.com/#3ENM44#7 It is buggy, but I have to run now. Only works when dragging on X now (and isnt always consistent). I'm sure the code could be condensed some more. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 Here's an alternative with snapping: http://www.babylonjs-playground.com/#YCKJBB#1 http://www.babylonjs-playground.com/#YCKJBB#2 I couldn't get the PG to work in the link that @Wingnut posted. Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 PG working as expected. Wingnut showing move by grid size not a collision with objects. Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 Hi @Arte, I was referring to this PG within the post: http://www.babylonjs-playground.com/#28EVFY#1 Wont work at my end. Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 It doesn't work for me, either. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 11, 2018 Share Posted July 11, 2018 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? Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 (edited) 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 July 11, 2018 by babbleon working browser Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 @babbleon, @Wingnut How about this https://www.babylonjs-playground.com/#T9HZNT#1 I need to improve snapping in my project. I know that together we can do something. *Edit* - green box draggable Wingnut 1 Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 Hey @Arte - that's great! In which way are you looking to improve yours? Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 When you move very fast (green box). It will snap inside box . I know we can check that is well. Another improvement: snap offset, and in general. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 11, 2018 Share Posted July 11, 2018 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. Arte 1 Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 11, 2018 Share Posted July 11, 2018 *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? Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 Snap offset would be preset for simplicity. Button in my project is just On-Off snap. Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 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 I need coffee to with pipe Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 11, 2018 Author Share Posted July 11, 2018 PG with user input offsets: http://www.babylonjs-playground.com/#YCKJBB#4 http://www.babylonjs-playground.com/#YCKJBB#5 (a bit buggy, rushed) Arte 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 11, 2018 Share Posted July 11, 2018 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. :) GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted July 11, 2018 Share Posted July 11, 2018 @Wingnut I know that it is not healthy . But I'm really enjoying for last N years. 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.