Tired of having to use the player mouse or the plugin mouse? Well here’s a solution! This module returns a custom mouse class that uses the
UserInputService instead. Yay! No more having to worry if
plugin:Activate(true) was called and still active etc.
I also added/adjusted a few properties to this custom mouse. They are described here:
--[[ mouse.TargetFilter [Instance] or [Array of Instances] > Determines an object (and its descendants) to be included when determining Mouse.Hit and Mouse.Target > Note for added functionality this can be set to either a single instance or a table of instances. > Defaulted to the workspace. mouse.TargetSurfaceNormal [readonly][Vector3] > Describes the SurfaceNormal of the BasePart surface at which the mouse is pointing mouse.ViewSize [readonly][Vector2] > Describes the width and height of the screen in pixels mouse.Position [readonly][Vector2] > Describes the X and Y components of the mouse’s screen position mouse.TargetBlackList [Instance] or [Array of Instances] > Determines an object (and its descendants) to be ignored when determining Mouse.Hit and Mouse.Target > This can be set to either a single instance or a table of instances. mouse.IgnoreCharacter [boolean] > Only applies when a local player's character exists and is automatically set to true. This is a very odd property I admit, > but for whatever reason the player mouse ignores the character so I figured I'd include this to perfectly emulate. --]]
The rest of the properties/events pertaining to the mouse function as normal. It is worth noting though that properties such as
mouse.DataCost do not exist with this custom mouse.
You can find the module here:
As part of this module I ended up writing some functions that extend raycasting a abilities a bit. Mainly I tried to emulate the concept from this thread.
You can find that module by itself here:
Both modules have further explanation of their API inside.
Hope this is helpful! Enjoy!