1. Post #1
    Syranide's Avatar
    April 2007
    146 Posts
    [release]Current version: 1.0.0, released on 2008-03-30, compatible with the GMOD update!
    If SmartSnap does not work for you, get the latest version first! FPS drops when showing the grid has been FIXED!

    [/release][release]●●●● Introduction ●●●●

    This is a client-side tool for building contraptions with extreme precision, aligning objects for either aesthetic or functional perfection. To accomplish this task a grid is projected onto the object you are pointing at and by pressing the use-button your weapon will lock onto that point and allow you to place objects with pin-point accuracy. For all entities be them square, round or uneven this tool will bring you perfect precision. This is a remake of the classic AutoSnap with a multitude of improvements. We all loved AutoSnap, and since the development of it had almost come to a halt I decided it was time to bring it back to life, the code has been written from scratch.

    If you have any feedback or ideas to improve this addon I would be very happy to hear them![/release][release]●●●● Model addons ●●●●

    Get the latest model addons here, corrected model offsets are included in each separate addon.

    PhoeniX-Storms: http://forums.facepunchstudios.com/s...d.php?t=488601
    Primitive Mechanics: http://forums.facepunchstudios.com/s...d.php?t=507452
    Tiled Building Blocks: http://forums.facepunchstudios.com/s....php?p=9284781[/release][release]●●●● Changelog ●●●●

    2008-03-30, v1.0.0 (important update):
    ● FPS drops when the grid is showing have been fixed, it is not directly caused by SmartSnap, but the use of SmartSnap increases per frame memory consumption and the garbage collector obviously handles this very poorly. Please give me some feedback on how this works out for you all.
    ● "default model offset" has been removed to improve consistency for model addons, it now hardcoded to 0.25 which appears to the default for the source models.
    ● Bumped to version 1 because it is about time now!

    2008-03-30, v0.9.5 (useful update):
    ● Grid offset only affects the outer border of the grid now and does not scale the entire grids, provides better snapping for "building blocks".
    ● Per model offsets are now provided for each separate model addon instead, update your model addons! (links above)
    ● Added "click grid" mode, disables the grid until USE is clicked while looking at a prop, looking away from a prop disables the grid again.
    ● Fixed a very rare bug that causes SmartSnap errors (thanks kevkev)

    2008-01-17, v0.9.4 (compatibility update):
    ● Using presets for settings instead (also fixes rare cases of the grid not showing)
    ● Should be fully compatible with the GMod update, complain here otherwise
    (Your settings will be reset when updating to this version)

    2007-12-23, v0.9.3 (minor update):
    ● Fixed per-model offsets, broke in last update
    ● Added default model offsets, should make corners useable on more models (option provided)
    ● Some minor optimizations
    (SmartSnap can be installed on servers and will downloaded to clients automatically)

    2007-11-28, v0.9.2 (compatibility update):
    ● Fixed errors that would appear when running the latest GMod10 beta
    ● New option to turn off the grid, leaving only the marker
    ● General optimizations and code improvements

    2007-07-22, v0.9.1 (compatibility update):
    ● Fixed settings not appearing in the spawnmenu since the GMod10 update

    2007-05-07, v0.9.0 (major update):
    ● Custom per-model offsets (more information below)
    ● New snap mode, perfect precision from "any" angle on any model, even rounded or uneven (more information below)
    ● New grid system, there are no longer gaps between the black and white lines, and the lines no longer go haywire when you are too close
    ● Easy access grid toggling, set "toggle delay" to enable, double-click the snap-key within that time to toggle the grid, console command "snaptogglegrid"
    ● Rewrote the square face picking routines
    ● Context mouse snapping is available again
    ● Thick center line for the grid (optional)
    ● New options (I'm open for more suggestions)
    ● And a lot of minor fixes everywhere

    2007-04-27, v0.8.1 (major changes):
    ● There is now a "lock snap mode", that will keep the snap without holding a key by binding a key to the "snaplock" (idea by Vampired)
    ● Based on the previous there is now a "smart snap lock" that will activate after a short delay, off by default and adjustable delay (idea by Vampired)
    ● The snap button can now be assigned to another key by binding that key to "+snap", "snap_disableuse 1" to disable default snap key
    ● The settings are no longer lost when restarting the game

    2007-04-25, v0.8.0 (initial release):
    ● The grid is black and white, visible on both light and dark objects
    ● The cursor indicates potentially bad angle with colors, red/yellow/green (new mode as of 0.9.0)
    ● The cursor is tilted to provide better visiblited
    ● The cursor turns turquoise in context mode if you are too far away and the margin of error will be noticeable (the cursor is imprecise)
    ● The aim now snaps completely to the grid, wobbling the mouse does not affect placement, also allows you to place objects from the other side of the map with pinpoint accuracy
    ● The snap does not release or shift when moving, it always sticks to the same snap point, you can even walk around the object while still attached to the same point
    ● The square grid works for all objects, regardless of the model
    ● The grid has been offset inwards slightly too minimize the common gap that was always present (for most square objects there is no gap now)
    ● The grid has been offset from the edges so that the outer lines of the grid are useable as well
    ● The objects' bounding box is made visible by blue markers on each corner
    ● The grid is selected by the aim/mouse and not the viewing angle, you can now point at any visible side and see the grid without moving
    ● The grid is smart, for smaller objects, less snap points will be available
    ● The snap point finding algorithm runs in constant time, meaning that regardless of number of snap points, it will always be as fast

    ●●●● Suggested improvements ●●●●

    ● Quickly accessible grid size settings (idea by AfTeRsHoCk)
    [/release][release]●●●● Installation ●●●●

    Simply unzip the archive into your garrysmod/addons-directory and it should be working, read the instructions on how to use it.

    ●●●● Instructions ●●●●

    If you have used AutoSnap before, there should not be any problem to understand this either, although there are some major improvements that might make it feel different, especially the new ultra precise mouse snap. For the uninitiated, it is very simple to use this addon, simply install it, start a game, spawn a prop, bring up the toolgun, look at the prop and a grid should appear. If you press use (e), the mouse should snap to the point you look at, and will signal with colors how precise the placement will be. Options for this addon is located under "Spawnmenu/Options/Smartsnap Settings". If you have any questions, I will be more than happy to answer them![/release][release]●●●● The new snap mode ●●●●

    As of v0.9.0, there is now a new technique in place for allowing perfectly placed objects that relies on the curvature of the object to position the mouse. It is now also possible to use the grid on round/uneven models, the grid will not fold around the model, but the snap will trace from the grid to the model to create a perfect snap.

    As of this, the color of the cursor no longer indicates the angle, but the actual distance between the calculated snap and where the object would end up (the error). Green indicated almost perfect precision, yellow means very good placement and red means the view is obstructed or the error will be significant. Turquoise means that it cannot snap because the model does not occupy that snap point and purple indicates that the snap is obstructed or failing to correctly trace a line.

    As this below image shows, some of you might think that the new SmartSnap is bugged or incorrect, but it is not, it's the new snapping that shows you where it actually ends up, this means that the grid will not always align to where the mouse aims as the actual bounding box of the object might be different. As seen above, I place 2 thrusters from two different angles on a round prop and they both end up perfectly horizontal.



    Also, very few entities behave oddly when traced as such the trace fails and reverts to the "old snap mode", indicated by a purple cursor. What this means is that certain props reports bad values when traced for certain snap points, this is not caused by my code but is a flaw in HL2 I believe. However, in almost all cases you can fix this by simply rotating the entity a little and it should be able to trace properly.

    ●●●● Per-model grid offset ●●●●

    As of v0.9.0, it is now possible to define individual grid offsets for each model, so that corners can be fully utilized and match the visual representation of the model with the position of the grid. A number of models (mostly PHX) has been predefined in the release with 0.01 precision.

    To create custom grid offsets yourself, you will have to bind buttons for "snap_dev_gridoffset <distance>", where distance is the distance to offset the grid for each press, I recommend binding 0.1/0.01/-0.1/-0.01 if you want to create precise grid offsets. To offset the grid, simply look at a face of the prop, and press the button and that grid will be slightly offset inwards (+) or outwards (-) (by using snap_dev_alloffset, all faces of the object will be offset by the same amount). Personal recommendation is to set the material of the object to matte white before starting. You must point at the object and execute "snap_dev_saveoffset" for it to be saved when you disconnect![/release][release]●●●● Demonstration of v0.8.0 ●●●●

    To show you how it looks and works I made an untalented video where I show off (in order):
    ● No gap between the grid and the object (barely visible blue marker)
    ● Place objects while snapped to the outer line of the grid
    ● Snap to the grid and walking around while snapped
    ● Cursor changing color at different angles (barely visible cursor)
    ● Grid visible on shiny white objects aswell
    ● Showing that the snap does not release when walking around or pushing the prop
    ● And the grand finale, placing a nailer with pinpoint accuracy from the other side of the map




    [/release][release]Credits goes to Black Phoenix for help with some vector math equations, Robbis_1 as he is the author of Autosnap and Locklear (Leon_307) for being the original inspiration for Autosnap.[/release]
    Reply With Quote Edit / Delete Reply Sweden Show Events Useful x 45Lua King x 33Friendly x 3Winner x 2Informative x 2Dumb x 1Artistic x 1Optimistic x 1Agree x 1Late x 1 (list)

  2. Post #2
    Finaldeath's Avatar
    March 2007
    178 Posts
    Yes you fucking did it lua kinged.

    Ps: sorry for my french :P
    Reply With Quote Edit / Delete Reply United States Show Events Funny Funny x 11Dumb Dumb x 10Disagree Disagree x 1 (list)

  3. Post #3
    Leigon's Avatar
    April 2007
    1 Posts
    Woh this is ausom, thanks finaly no more weard jumpy snapping :)
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Bad Spelling Bad Spelling x 13Dumb Dumb x 6Funny Funny x 1 (list)

  4. Post #4
    MaZz3's Avatar
    March 2007
    38 Posts
    Really good job!
    Reply With Quote Edit / Delete Reply Germany Show Events Agree Agree x 3 (list)

  5. Post #5
    Gold Member
    henrikb4's Avatar
    June 2005
    217 Posts
    You got a download!
    Reply With Quote Edit / Delete Reply Denmark Show Events Agree Agree x 1 (list)

  6. Post #6
    Gold Member
    Metroid48's Avatar
    February 2007
    1,020 Posts
    Nice, does seem really similar to autosnap. Is this client side, like autosnap?
    Reply With Quote Edit / Delete Reply Canada Show Events Dumb Dumb x 1 (list)

  7. Post #7

    February 2006
    4 Posts
    thank you so much

  8. Post #8
    Syranide's Avatar
    April 2007
    146 Posts
    Thanks you all for the comments! ;)

    Metroid48 posted:
    Nice, does seem really similar to autosnap. Is this client side, like autosnap?
    Yes, this is "autosnap", but I rewrote it from scratch and added all the improvements mentioned in the first topic. So you will feel very familiar, and it is 100% client side.

  9. Post #9
    garry's Avatar
    September 2001
    12,384 Posts
    This is pretty interesting..
    Reply With Quote Edit / Delete Reply Show Events Agree Agree x 17Dumb Dumb x 1Lua Helper Lua Helper x 1Optimistic Optimistic x 1 (list)

  10. Post #10
    Tatourmi's Avatar
    October 2006
    12 Posts
    This is really useful for the contraptions :D
    Reply With Quote Edit / Delete Reply France Show Events Agree Agree x 2 (list)

  11. Post #11
    Bad HAL 9000's Avatar
    January 2005
    48 Posts
    Great, was looking forward to this. :)
    Reply With Quote Edit / Delete Reply Show Events Agree Agree x 1 (list)

  12. Post #12
    Razot's Avatar
    April 2007
    13 Posts
    um... what does it do

    (User was banned for this post (Reason: RCP (in post "Re: SmartSnap (snap the mouse to objects)" by garry)))
    Reply With Quote Edit / Delete Reply South Africa Show Events Dumb Dumb x 4Funny Funny x 1Agree Agree x 1 (list)

  13. Post #13
    Syranide's Avatar
    April 2007
    146 Posts
    Razot posted:
    um... what does it do
    Just like Autosnap, it allows you to "snap" the view to a grid, allowing you place thrusters/gates/whatever or weld/etc with perfect precision on most square objects. So it's a tool for building precisely aligned contraptions and groups of objects.

  14. Post #14
    TheTiger's Avatar
    November 2006
    491 Posts
    just similar with auto snap but better but anoying thing that some of grid goes inside prop but better corner grid's than in autosnap gold star for you

  15. Post #15
    Phasy's Avatar
    May 2005
    8 Posts
    It does not work.

    It's in the addons folder, I installed it on both my server and on my client, yet there is no menu for it in options, and it doesn't seem to work at all.

  16. Post #16
    Syranide's Avatar
    April 2007
    146 Posts
    TheTiger posted:
    just similar with auto snap but better but anoying thing that some of grid goes inside prop but better corner grid's than in autosnap gold star for you
    Aha, that will be fixed in a coming version, it will then be possible to specify offsets for specific props, which allow it to align perfectly for all square props. Expect to see this any day.

    I temporarily have a global inward offset for the grid at the moment because it allows for an overall smaller gaps.

    Edit:

    Phasy posted:
    It does not work.

    It's in the addons folder, I installed it on both my server and on my client, yet there is no menu for it in options, and it doesn't seem to work at all.
    Oh sorry, this is most likely because you have to have a tool-weapon (e.g. nailer, thruster etc) in your hands for it to show! Very sorry that I forgot to mention this in the initial post, will fix it immediately.

  17. Post #17
    Gold Member
    conman420's Avatar
    January 2007
    1,794 Posts
    THANK YOU! I was so annoyed by the bug in auto-snap where the corners where off the prop :( You are my saviour!

    Was this built from scratch or did you just edit robbis's code?

    Never mind about that bit I just read a post above.

    Nice work!

  18. Post #18
    Phasy's Avatar
    May 2005
    8 Posts
    Syranide posted:
    Oh sorry, this is most likely because you have to have a tool-weapon (e.g. nailer, thruster etc) in your hands for it to show! Very sorry that I forgot to mention this in the initial post, will fix it immediately.
    Yeah, now that you mention it, that's probably it.

    I don't think it works on vehicles, does it?

    Edit:

    By the way, if it only shows when your holding a tool weapon, does that mean it also only shows in the options menu when your holding a tool weapon?

  19. Post #19
    Syranide's Avatar
    April 2007
    146 Posts
    Phasy posted:
    Yeah, now that you mention it, that's probably it.

    I don't think it works on vehicles, does it?
    Only works on props at the moment, but I will add an option for it to show up on everything in the next release, although, it might not align very well for most vehicles as they tend to have non-square forms, but it should be useable still if you just make sure to have a green cursor before placing.

  20. Post #20
    Phasy's Avatar
    May 2005
    8 Posts
    Yeah. Anyway, the option problem was my fault and it works now. Good work, have a gold star for the mod and the support.

  21. Post #21
    Joel_Yeah's Avatar
    July 2006
    69 Posts
    Syranide posted:
    I made an untalented video where I show off
    Fixed

    Also, looks great, got my download :D

    [spoiler]tl;dr... Looks great though :ninja:[/spoiler]

  22. Post #22
    Gold Member
    conman420's Avatar
    January 2007
    1,794 Posts
    You might want to increase the gap between the corner. On the cargo container you get the annoying corner bug!

    Robbis_1 posted:
    That's not bugged.. I added 4 sliders for each corner. The way it scales depends on the prop.
    If you're so clever now, go ahead and make it better.
    Robbis asked for it there didn't he?

  23. Post #23
    Syranide's Avatar
    April 2007
    146 Posts
    conman420 posted:
    You might want to increase the gap between the corner. On the cargo container you get the annoying corner bug!
    Will be fixed when I implement the per prop "offset" for the grid (should be very very soon), increasing the default grid edge offset would become problematic with thin props (which are already quite tight).

    (And I will most likely specify such offsets in advance for most props, so you don't have to do every single one yourself)

  24. Post #24
    NisseOwned's Avatar
    July 2006
    4 Posts
    Oh snap!
    Great, been wanting something like this for long :excited:
    Reply With Quote Edit / Delete Reply Sweden Show Events Funny Funny x 1 (list)

  25. Post #25
    Gold Member
    elevator13's Avatar
    December 2006
    2,484 Posts
    I loved Robbis' autosnap, and I can't wait to try this out :keke:

  26. Post #26
    AfTeRsHoCk's Avatar
    May 2005
    7 Posts
    NisseOwned posted:
    Oh snap!
    ...
    Indeed.

    One suggestion though, could you add a feature so that it allows you to change the settings of the snap-grid via something other than the settings menu? Like, maybe a second context panel or something equally (most likely) impossible and ridiculous.

    It's just kind of a hassle to keep going back and forth between the STool menu and the settings menu when you're working on different props.

    Other than that, great job!

  27. Post #27
    darkstar7878's Avatar
    May 2006
    11 Posts
    Thank you so much, I wish I could rate you twice... but I'm just gonna rate you winner... Because you are a winner. :P

  28. Post #28
    Syranide's Avatar
    April 2007
    146 Posts
    [QUOTE=AfTeRsHoCk]
    NisseOwned posted:
    Oh snap!
    ...QUOTE]

    Indeed.

    One suggestion though, could you add a feature so that it allows you to change the settings of the snap-grid via something other than the settings menu? Like, maybe a second context panel or something equally (most likely) impossible and ridiculous.

    It's just kind of a hassle to keep going back and forth between the STool menu and the settings menu when you're working on different props.

    Other than that, great job!
    The best I can come up with at the moment is console command for those that you can bind to different buttons (increase/decrease size). Possibly if I have time I might add a secondary button instead, which would bring up something like a quick options-dialog where the cursor is, allowing you to edit the most common ones.

  29. Post #29
    Naes Draw's Avatar
    March 2007
    54 Posts
    This is handy.

  30. Post #30
    AfTeRsHoCk's Avatar
    May 2005
    7 Posts
    Syranide posted:

    The best I can come up with at the moment is console command for those that you can bind to different buttons (increase/decrease size). Possibly if I have time I might add a secondary button instead, which would bring up something like a quick options-dialog where the cursor is, allowing you to edit the most common ones.
    That would great, awesome, thanks! :D

  31. Post #31
    Sam_!00!'s Avatar
    March 2007
    26 Posts
    Razot posted:
    um... what does it do

    (User was banned for this post (Reason: RCP (in post "Re: SmartSnap (snap the mouse to objects)" by garry)))
    Garry is not amused!

    Anyway back on topic...

    Nice!

  32. Post #32
    Gold Member
    Mr.123's Avatar
    February 2006
    255 Posts
    Good job I used the regular autosnap all the time for wire mod but it always messed up.

  33. Post #33
    Sam_!00!'s Avatar
    March 2007
    26 Posts
    Holy shit!

    Awesomeness!

  34. Post #34
    dkikisb's Avatar
    April 2007
    5 Posts
    Great! Have to try this out!

  35. Post #35
    bye
    Gold Member
    bye's Avatar
    August 2006
    3,081 Posts
    According to you, what are 'bad' angles?

  36. Post #36
    Syranide's Avatar
    April 2007
    146 Posts
    Roo-kie posted:
    According to you, what are 'bad' angles?
    Bad angles are if you are looing at an angle not straight at the face of the prop (if you are looking from the side or not so to speak, in mathematical terms, the angle between your viewing angle and the normal of the face), if the prop has an uneven surface or not correctly offset grid then the placement of the object will not be perfectly centered if you are looking from the side, therefore I have set the cursor to indicate green at 10 degrees and yellow at 20 degrees... for normal squared props with correctly offset grid, it shouldn't matter at all.

    EDIT: on another note, I am working on the offsetting for the grid and it is working out very nicely and easy to work with, although I have to add another offset for offsetting the grid from the edges too (because some props actually have bigger collission boxes than what they "should have", like the red dumpster, these will have the possibility of offsetting the grid from the edges as well. Although there is still some way to go to get it all working (needs a "dev mode" so that it is easier to position the grid and so on).

    Here is a picture of the dumpster having perfectly slimmed bounding box (although note that for the dumpster it is stupid because it really is bigger, but to show the concept, the white dumpster is just because it is easier to see)


  37. Post #37
    mblunk
    Guest
    Can you make a mirror please, garrysmod.org isn't working for me right now.

    Edit:

    Please? I'll make a promotional video for you if you do. I've made promo videos for an old gmod9 fireworks script, ULX and the Tool Turrets addon.

  38. Post #38
    Syranide's Avatar
    April 2007
    146 Posts
    mblunk posted:
    Can you make a mirror please, garrysmod.org isn't working for me right now.
    It has been done! VS-SH should be fine I presume.

  39. Post #39
    Gold Member
    jaybuz's Avatar
    May 2006
    5,516 Posts
    mblunk posted:
    Can you make a mirror please, garrysmod.org isn't working for me right now.

    Edit:

    Please? I'll make a promotional video for you if you do. I've made promo videos for an old gmod9 fireworks script, ULX and the Tool Turrets addon.
    Lol blunk you make me laugh.

  40. Post #40
    mblunk
    Guest
    jaybuz posted:
    Lol blunk you make me laugh.
    How so?

    Edit:

    Syranide posted:
    It has been done! VS-SH should be fine I presume.
    Do you have a specific due date you'd like the movie at? If you want it fast, I could get you a view within a few hours, but it probably wouldn't be very good. If you don't care when you get it, I could get you something real nice by the end of the weekend.