I’m looking to make custom gizmos for plugins and want them to only affect visuals. Currently I’m CFraming parts parented to workspace.CurrentCamera, but here’s the problem:
Moving parts is problematic when gizmos are in the way when using built-in move tools (select tool, or other ones with collisions enabled)
Creating and removing gizmo parts affects ChangeHistoryService, undoing an action will try to reparent the gizmo parts, even though :Destroy() has been called on them and parent property is locked
Haven’t tried, but parenting the gizmo parts to workspace.CurrentCamera could cause problems in Team Create
I’ve tried to parent the gizmo parts to CoreGui, but the parts aren’t rendered there. I think this was possible way back in the day. The number of parts I’m drawing can range from 20 to as many as 500, so it would be great if those parts didn’t affect collision calculations when moving the host part.
Is there a way to do this? Help would be greatly appreciated.
I don’t know if this will work with your scenario, but I know for a fact it’s impossible for it to not affect ChangeHistoryService as there’s no API for whitelisting/blacklisting parts.
Group your assembly of visual parts into a folder and set PluginMouse.TargetFilter to that group. This will ignore selections across your purely-visual parts, or rather it should. I don’t make plugins.
Another option, albeit potentially hacky, is to make use of the Selection service. Use SelectionChanged to determine, of course, when a user changes their selection. Run Selection.Get to retrieve an array of currently selected objects, remove your visual parts from this array and then use Selection.Set to set the current selection to the same as what it was before, with your parts filtered out.
I am unaware of how to make these parts detached from collisions or the ChangeHistoryService, though things done by plugins shouldn’t be registered by it unless you set a keypoint. Sorry I can’t help in that regard. I know plugins have done it and still do, but I haven’t looked at enough plugin sources or experimented around enough to provide an answer for this.
Box/Cone/Cylinder/LineHandleAdornments to the rescue!
Those are the objects that you should really be using to build in-world plugin UI out of, not parts. They’re 3d objects that you can put in the CoreGui, but render in the world by setting their Adornee to something. You can even draw an arbitrary image in the workspace using the ImageHandleAdornment
Don’t miss that they have a CFrame property on them too, so you can position them exactly as you want relative to the Adornee.