Hey everyone! I created the V1 of this module for a game I’m working on and it was refined by @GollyGreg on GitHub.
The source can be found here: https://github.com/Imaginaerume/rbx-ObjectHighlighter
Readme below V
This module allows you to make an object or model act as “Always on Top” (or X-Ray) and layer over the normal 3D game world.
Table of Contents
To provide an generic and extendable solution to adopting ViewportFrames as a means to render an object on top of a 3D environment.
This is intended to replace older solutions such as rbx-XRayAdornment. Our previous issues with this old xray module is that it made it really hard to balance the state of the target object with the actual rendering process.
There was some difficulty in making a good “only-render-when-obstructed” highlighted object. All attempts were messy and oddly coupled with the creation of the XRayAdornment itself.
Our philosophy is to separate highlight state from highlight render rules.
Check out our other annotated examples in the
local ObjectHighlighter = require(ReplicatedStorage:FindFirstChild("ObjectHighlighter")) -- This screen gui will contain our ViewportFrames local myScreenGui = Instance.new("ScreenGui") myScreenGui.Name = "ObjectHighlighter" myScreenGui.Parent = Players.LocalPlayer.PlayerGui local myRenderer = ObjectHighlighter.createRenderer(myScreenGui) -- Assume we have a Model as a direct child of Workspace local myHighlight = ObjectHighlighter.createFromTarget(Workspace.Model) -- Apply our highlight object to our Renderer stack. -- We can add as many highlight objects to a renderer as we need myRenderer:addToStack(myHighlight) RunService.RenderStepped:Connect(function(dt) -- Our renderer will not render until it steps myRenderer:step(dt) end)
Feel free to post here or DM me or @GollyGreg any questions, comments, issues or feedback