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

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

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]

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.

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.

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?

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.

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)

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.

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.

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.

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)

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.