Modding, Mission Design, and Coding > The Scripting Workshop

Draw graphic over 3D objects?


I'm nearly certain this is possible, because I've seen it done before, but I couldn't figure out how.

I have a script where I use both gr.drawRectangle and gr.drawCircle. However, whenever they overlap an object in the game world, they get occluded by the object. 

How do I set them to draw on top of the 3D objects? Even better, if I can set a distance so that they still get hidden by objects close to the camera, that'd be perfect.

Can you post a screenshot of the issue you are having? From your description it sounds like you are drawing with depth testing enabled but that is explicitly disabled for the 2D draw operations.

Also, explicitly setting a depth is not something that is possible with those functions. They will always draw on top of every thing that is behind the drawn to area.

I figured it out just as I opened the script to set "filled" to true with the intent of making it more visible for the screenshot. I was calling it on $On Object Render, when I should have been using $On Frame.

With $On Object Render:

With $On Frame:

Yes, On Object Render is a very specific hook. On Frame is the correct hook to render 2D graphics.


[0] Message Index

Go to full version