• SmartSnap (snap the mouse to objects)
    552 replies, posted
  • Avatar of Sam_!00!
  • [QUOTE=Razot]um... what does it do [b][highlight](User was banned for this post (Reason: RCP (in post "Re: SmartSnap (snap the mouse to objects)" by garry)))[/highlight][/b][/QUOTE] Garry is not amused! Anyway back on topic... Nice!
  • Avatar of Mr.123
  • Good job I used the regular autosnap all the time for wire mod but it always messed up.
  • Avatar of Syranide
  • [QUOTE=Roo-kie]According to you, what are 'bad' angles?[/QUOTE] 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) [URL=http://img80.imageshack.us/my.php?image=63759001hh6.jpg][IMG]http://img80.imageshack.us/img80/8606/63759001hh6.th.jpg[/IMG][/URL]
  • Avatar of Missing User
  • Can you make a mirror please, garrysmod.org isn't working for me right now. [b]Edit:[/b] 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.
  • Avatar of Syranide
  • [QUOTE=mblunk]Can you make a mirror please, garrysmod.org isn't working for me right now.[/QUOTE] It has been done! VS-SH should be fine I presume.
  • Avatar of jaybuz
  • [QUOTE=mblunk]Can you make a mirror please, garrysmod.org isn't working for me right now. [b]Edit:[/b] 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.[/QUOTE] Lol blunk you make me laugh.
  • Avatar of Missing User
  • [QUOTE=jaybuz]Lol blunk you make me laugh.[/QUOTE] How so? [b]Edit:[/b] [QUOTE=Syranide]It has been done! VS-SH should be fine I presume.[/QUOTE] 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.
  • Avatar of sharpshark28
  • This is amazingly perfect. This will always from now on be the FIRST thing I install whenever I redo Gmod. Also, is there a way to make a toggle key for the grid? (To turn on and off) Because a friend and I play a retarded game together that grid ruins the fun of :P (varient of hide and seek) Thanks! King'd
  • Avatar of Rysoke24
  • [QUOTE=TwingeCrag]Leon, are you disabed? :downs:[/QUOTE] I don't know if you should be calling people disabled -> You spelled, disabled wrong. :downs:
  • Avatar of Q42
  • I know there's already one of these, but this one looks a HELL of a lot better, being that you don't have to be point-blank to work on things. That part with the nail gun. WOW.
  • Avatar of zlatko
  • Very nice! Makes building with precision much easier. This is definitely going on my server, gold star for you!
  • Avatar of Q42
  • Just tried it out and... well... you are my god now. Building the temple may take awhile though. lazy you see. [spoiler]need a smartsnap for real life :P[/spoiler]
  • Avatar of Syranide
  • Thank you all for the very positive feedback which is very inspiring to receive, and know that I am still working on it and are planning to improve it over time, as you might've read above, I'm currently working on setting per-model offsets so that it is possible to create perfect snaps for every predefined model. It now also saves the settings and it is possible to map a user key to snap instead of default (USE), these among others will be in the next version. [QUOTE=sharpshark28]This is amazingly perfect. This will always from now on be the FIRST thing I install whenever I redo Gmod. Also, is there a way to make a toggle key for the grid? (To turn on and off) Because a friend and I play a retarded game together that grid ruins the fun of :P (varient of hide and seek) Thanks! King'd[/QUOTE] You can turn off the grid in the options (I'm guessing you don't actually need a key for it?), or use the console variable "snap_enabled 0". (just for fact, it is possible to bind this console var to a key too that would make it toggle) [QUOTE=Leon_307]This is a copy of Locklear's Autosnap![/QUOTE] It is not a copy, it's a remake, one that apparently was appreciated. And I've added credit to locklear now as I wasn't aware of that he was the original inspiration. [QUOTE=Q42]Just tried it out and... well... you are my god now. Building the temple may take awhile though. lazy you see. [spoiler]need a smartsnap for real life :P[/spoiler][/QUOTE] I'll see what I can do about that, a temple would indeed be nice :v:
  • Avatar of Vampired
  • I'm going to Lua King you Syranide. This script is excellent. I can see that you have worked hard on this. I like how it runs smoothly, how it smartly chooses the size of the grid, how neat and shiny your code is, and also how I can walk around and it will still snap to the original point with no problem. However, I don't like pressing lots of keys at once for example E to snap and W, A to move for example. So I decided to edit your code a bit to enable it to toggle. Hope you don't mind but here's what I came up with. Press to toggle on, press to toggle off. Press and hold will toggle on, release will toggle off. [lua] ... -- Starts about line 115. -- Added these local variables, move them or rename them if you need. local toggled = false local lastpress = 0 local function OnPaintHUD() if (GetConVarNumber("snap_enabled") == 0) then return end -- Moved these two lines before the 'target.locked = ...' and 'target.active = ...' if (!player:IsValid()) then return end if (!player:Alive() or !player:GetActiveWeapon():IsValid()) then return end -- Added this section. if (player:KeyDown(IN_USE)) then if(lastpress == 0) then toggled = !toggled lastpress = CurTime() end else if(lastpress > 0 and CurTime() > lastpress + 0.5) then toggled = false end lastpress = 0 end if(!target.active) then toggled = false end -- End -- Changed 'player:KeyDown(IN_USE)' to 'toggled' target.locked = toggled and target.active == true target.active = false ... [/lua] Also another thing that bugged me was if you got too close to or inside the prop then the lines would go in the wrong direction. Lastly, I saw you say you were going to be able to save the options and I also saw the /data/defaults.txt so are you going to save to a text file? I more simpler way would be to use. [lua] -- Third argument to true makes the convar save. CreateClientConVar("snap_enabled", 1, true, false) [/lua] Thanks for the great script.
  • Avatar of Robbis_1
  • Ahh.. A fresh remake of the Autosnap. Have to say it's about time, because I'm getting a little rusty (no time :() nowadays and that script was like 4 months old. Interesting feedback you get though (that I didn't get), which made me stop updating it.
  • Avatar of Robbis_1
  • [QUOTE=Vampired]Yours was good too Robbis_1 :D[/QUOTE] Durr... Apparently not good enough. But nothing can be perfect, can it?
  • Avatar of Syranide
  • [QUOTE=Vampired]I'm going to Lua King you Syranide. This script is excellent. I can see that you have worked hard on this. I like how it runs smoothly, how it smartly chooses the size of the grid, how neat and shiny your code is, and also how I can walk around and it will still snap to the original point with no problem. However, I don't like pressing lots of keys at once for example E to snap and W, A to move for example. So I decided to edit your code a bit to enable it to toggle. Hope you don't mind but here's what I came up with. Press to toggle on, press to toggle off. Press and hold will toggle on, release will toggle off. [lua] ... [/lua] Also another thing that bugged me was if you got too close to or inside the prop then the lines would go in the wrong direction. Lastly, I saw you say you were going to be able to save the options and I also saw the /data/defaults.txt so are you going to save to a text file? I more simpler way would be to use. [lua] -- Third argument to true makes the convar save. CreateClientConVar("snap_enabled", 1, true, false) [/lua] Thanks for the great script.[/QUOTE] Hey there! Although I have to say not all the code is so neat and shiny yet, but it hopefully will be ;) Excellent idea there, I have support in the current version for snapping to the grid with other keys using console commands, and I guess you can make it toggle by binding in a specific way too, although what you suggest there using both snap and lock (using delay) is really really great, definately available in the next version. Regarding the lines, there is no fix for that that I know of, it's ToScreen() in garrysmod that messes up when you get too close (probably something with the projection, because it often just flips to the wrong side and so on) ... I will have a look at this further on, as I think it is possible it to solve using a slightly slower method. Saving the options, using CreateConVar(..., ..., true, ...) doesn't save it (cold12141 ;)), that only implies that a convar is saved when you save a game (I've tried it, resets everytime you restart) ... but I have implemented a custom method for saving the settings (also next release). I've looked around, although I know this is automatic for TOOLs, I haven't found a way to create global convars without having a tool. "defaults.txt" is not intended for settings, it's basically just a placeholder for default prop offsets for the grid, when it is available (working on this at the moment). Of course I don't mind, this is EXACTLY the kind of ideas that I want, reasonable, useful and simple to use. [QUOTE=Robbis_1]Ahh.. A fresh remake of the Autosnap. Have to say it's about time, because I'm getting a little rusty (no time :() nowadays and that script was like 4 months old. Interesting feedback you get though (that I didn't get), which made me stop updating it.[/QUOTE] I am very glad that you feel that way, I believe your autosnap was widely appreciated although everyone might not have expressed their gratitude, apparently, people never stopped using it once they tried it ;) me neither ... (and you see where it got me :v:) (it's sad that more people don't see the power in the simplest of feedback, which has brought many addons to a standstill)
  • Avatar of Skorpy
  • I usually don't like that people go and recreate a something that someone has already done. But if creator of the first one says the second one is good or better, I quess I just have to download it then...:S
  • Avatar of terrorclaw
  • I have used the first, and this reads like it will be a lot better, going to try it here in a bit.
  • Avatar of cold12141
  • [QUOTE=Syranide]Saving the options, using CreateConVar(..., ..., true, ...) [B]doesn't not save it[/B], that only implies that a convar is saved when you save a game (I've tried it, resets everytime you restart) ... but I have implemented a custom method for saving the settings (also next release). I've looked around, although I know this is automatic for TOOLs, I haven't found a way to create global convars without having a tool. )[/QUOTE] So, what you're saying is that it does save it when use a con var? Two negatives makes a positive =) Just kidding, great script. Already on my two servers.