DAdjustableModelPanel - Having a couple of issues

It’s only been a day since my last help thread (not even a day technically), but this is one of the few ways I can get help on these things. So, I’m trying out the code sample for creating a DAdjustableModelPanel on the Gmod wiki:

The box was rather small and I didn’t like where it was positioned, so I modified the code (I only modified the size and position. That isn’t the cause of my problems, I had them before changing the code too). The problems I am having:

  1. The model doesn’t initially appear in sight. However, this may have to do with both me having Garrys Mod in windowed mode, and the box not being precisely centered and enlarged. Is there a way I can change where the model will precisely appear in the box? I have to keep dragging it to the left to catch it.

  2. There’s no clear border on the panel. Initially I thought to simply paint a box on it like in the basic derma tutorial, but painting appears to cause the DAdjustableModelPanel to not work properly, as the model no longer is visible even after dragging it in to the open. (I set its opacity quite low so I could see through the box, so that’s not the reason) How can I make a clear border on the DAdjustableModelPanel so I can see where it begins and ends?

  3. When I do get the barrel out in the open, it’s at a very odd angle. I can’t seem to rotate it, is there a way to rotate it on to a proper side? If not, how else might I get it angled properly?

The documentation on the functions for DAdjustableModelPanel seem non-existent, so I’m really in the dark here. I hope someone can help me, I’m seeing a lot of potential uses for this VGUI element!

Well if your ever curious about how a VGui element works and there’s no documentation, you can look at the source code.

Just search the Garry’s Mod github repository for the element your looking for. The results will contain not only the source code for the element, but also examples of where it is used in the garry’s mod code.

Here’s some links:
The Search
The source code
It’s use in the Model Icon Editor

Hope this helps.

I can’t find the undocumented functions for use in the DAdjustableModelPanel in its own source file. Where can I find them? If I can find those functions and look at them, I might be able to solve my problem.

What undocumented functions? DAdjustableModelPanel adds only [Get/Set]FirstPerson, everything else is as documented on the DModelPanel pages.

Any functions not found in that vgui element will be in the parent all the way to the PANEL meta-table.

So, DModelPanel, then DPanel, then Panel.

Basically it’s reading input from the mouse and keyboard to move the camera and change the fov ( Bit late on their implementation, one of the first things I did to DModelPanel :stuck_out_tongue: ).

Anyway, without modifying the source of the vgui element; you’d need to grab the variable referencing the entity/model. And the one associated with the camera. Use the camera, and SetLookAt to the vehicle; that’ll ensure the camera is looking at the entity.

Sounds like that’s my answer… curses for things being so complex when I’m so new. Thanks for the help!

My bad, I didn’t phrase it right. Methods.


I’d guess I could only find those in the PANEL lua file, or something like that. In either case, it looks like my question was answered as best as it could be… thanks for the help!