How should I make a button using 3D2D? Ylsid suggested using a seperate entity and ENT:Use().
set the buttons angles, set the buttons vector, and check the mouses position
How are you going to click it, using the mouse?
If so you need to listen for then the mouse is clicked and check if the x and y is near the x and the y returned from the vector ToScreen method.
[b][url=http://wiki.garrysmod.com/?title=Vector.ToScreen]Vector.ToScreen [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
No zack, draw them, check the mouses position relative to where you positioned them and use input.IsMouseDown() to check for mouse input, there is no need to ToScreen anything
[QUOTE=c-unitV2;32246316]No zack, draw them, check the mouses position relative to where you positioned them and use input.IsMouseDown() to check for mouse input, there is no need to ToScreen anything[/QUOTE]
How are you going to determine if the mouse is hovered over the button when he clicks?
[QUOTE=zzaacckk;32249460]How are you going to determine if the mouse is hovered over the button when he clicks?[/QUOTE]
[QUOTE=c-unitV2;32246316]No zack, draw them, [b]check the mouses position relative to where you positioned them[/b] and use input.IsMouseDown() to check for mouse input, there is no need to ToScreen anything[/QUOTE]
You can use the functions added as help on the wiki.
[b][url=http://wiki.garrysmod.com/?title=Cam.Start3D2D]Cam.Start3D2D [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
And for use detection you can use this [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerUse]Gamemode.PlayerUse [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b].
[QUOTE=Thermadyle;32249811].[/QUOTE]
And I am asking how does he plan on doing that.
gui.MouseX() && gui.MouseY(). Those functions return the mouse position.
If the player is static when pressing the buttons cunits method will work.
Cunits method works like, if you taped a piece of paper on the screen if you went under that paper and clicked it would work, so you would draw something with 2d3d but if you moved out of that predefined position it wouldnt work.
Why do you all assume I am using a mouse?
Anyways, for the button, should I just check if the look vector is between a range?
I have a few questions to help you.
1. Will these buttons be moving on your screen? Or will they be located atthe same position the entire time?
2. Are they 3D2D buttons you want the player to be able to interact with?
[editline]14th September 2011[/editline]
If you answered number 1 as yes, then you need to use _R.Player:GetShootPos() to check if his mouse is in range.
If you get all four vectors you can use the Vector.ToScreen method and compare them by making sure the gui.MouseX and the gui.MouseY is between them.
Later ill look into seeing what the unit ratio is for 3D2D so you won't need to find all of the vectors, just the one you need to place it at.
Sorry, you need to Log In to post a reply to this thread.