Gizmos available in game #3203
garrynewman
announced in
Announcements
Replies: 1 comment 1 reply
-
Great news! But does this supposed to work with [Event.Debug.Overlay("test", "Test", "square")]
private static void TestOverlay()
{
Gizmo.Transform = new Transform();
Gizmo.Draw.IgnoreDepth = true;
Gizmo.Draw.Color = Color.Green;
Gizmo.Draw.LineCircle(position, radius);
}
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
You can now use gizmos in game. This is a stepping stone to allowing hammer entities to have their own gizmos and implementing some kind of scene view of the main game world.
When using gizmos in game code you need to be aware that if you're creating/using gizmos serverside, they will only show on the listen server host's client pc. They will still totally be usable, and it's totally valid to be doing this stuff for debugging - but if you're doing it expecting other clients to be able to use them - they won't.
What is the gizmo library
Think of gizmos are like IMGUI but for the 3d world. You can use them to draw debug shapes or models or particles.
The main use case is for adding development gizmos, like position and rotate.. but you could totally use them to render effects and other clientside 3d interactables in your actual game.
Example
Each banana in this scene is rendered using the Gizmo api. Every frame a function is called which is saying "render a banana here". The gizmo library does all the optimizing work on the backend saying "this is the same banana object as the last one, so don't change anything" to keep things running nice.
sbox_0043.mp4
The code for rendering one of these bananas is simply
Beta Was this translation helpful? Give feedback.
All reactions