We have exposed Getters and Setters for each of the following properties on the ClickToMoveController. You can get a reference to the ClickToMoveController by requiring the PlayerModule and using the GetClickToMoveController method. See the example below.
Bool ShowPath - Should the path that the user is taking should be displayed? Defaults to true.
Content WaypointTexture - The texture to be used for the ImageHandleAdornements to display the path.
Number WaypointRadius - The size of the dots to display the path to the user.
Content EndWaypointTexture - The texture to be used for the end waypoint in the path.
Bool WaypointsAlwaysOnTop - Should the waypoints should display always on top or not? Defaults to false.
Bool FailureAnimationEnabled - Should an animation be played on the user’s character when a path can not be found? Defaults to true.
String IgnoredPartsTag - A tag using CollectionService for parts to ignore when determining the point that the user clicked on. An example of when a you would want to use this is an inviscam style setup where the user can see through some parts.
Bool UseDirectPath - Turns off pathfinding so that the user just moves in a direct line to the point they clicked if nothing is blocking the way.
Bool UserJumpEnabled - Should the user be able to trigger a jump themselves or should the jumps be handled by the pathfinding system? Defaults to True.
Additionally we have exposed a function that allows developers to leverage the click to move module to make the players character to move to a given location. This allows you to leverage the click to move display and pathfinding to move the players character.
ClickToMoveController:MoveTo(Vector3 position, bool showPath = true) - Move the users character to a given point using the click to move module.
Example:
local LocalPlayer = game:GetService("Players").LocalPlayer
local PlayerModule = require(LocalPlayer.PlayerScripts.PlayerModule)
local ClickToMoveController = PlayerModule:GetClickToMoveController()
ClickToMoveController:SetShowPath(false)
ClickToMoveController:SetUserJumpEnabled(false)
print(ClickToMoveController:GetWaypointTexture())
In the future, we plan on adding more customization options to the other Camera and Control scripts so please let us know if you have any idea for options you would like to see!
This is a cool little update, with a nice API alongside it. I’d love to see the shrug animation available to use as an emote.
Could we see ClickToMoveController:RegisterInput(input) and ClickToMoveController:DeregisterInput(input) functions, where input is a KeyCode or UserInputType? The function would register or deregister an input that activates the tap to move mechanic. This would be useful for developers that already use the default key-binds for another action.
try making this feature instead shaking when you cannot reach the spot.
make that the baloon shake them explode to a red (X) showing that u cannot reach the selected spot.
i think this is better than just shaking.
This will definitely give the game a more cartoonish style. However if there is tap to move one con is that it may make it harder to move higher distances. It also may make it harder to play obbys. But overall it’s a really cool feature that should be enjoyed by the community!
It would be cool if there were events exposed for whenever the pathfinder fails to find a path for the player instead of just a bool on whether an animation should be played, that way there could be more customization. Every other limitation I can think of could be worked around with a custom script though.
If there’s a gap in between the place you are and your destination, but there’s a truss or something like that, would it shrug or make you walk off and climb the truss??
Let me guess this will only apply to R15 and Rthro packages and not R6? It’s been quite easy to do a shrug animation for R6 before granted limited ‘bendability’ in the limbs but it’s not impossible to do.
I’ve been to a number of games that have a ‘confused’ animation - even for R6. I’ve seen a version which involves a small shuffle offset of the feet left left forward slightly, right leg behind slightly before putting arms up, rotating of the head and a look down. Looking like the player is about to move but then stops, hesitates.
It’s just means everything is nice and consistent which is nice. It would be a shame for R6 to be continued to be left behind.
I really wish that this would turn red to indicate “no, cannot be done sorry” it screams so much at me that it would be nice if it wiggled into red.
Edit: devforum doesn’t want me uploading video so I give up
Sorry for the bad quality, I tried to record something as quick as I could and mp4 did not work. I noticed a few bugs with this, specifically jumping. Another bug happens if you press any movement key a few frames after the pathfinding is calculated where it stays on the screen, despite the fact you cancelled the operation.
(Note, when the pathfinding tried to clear the gap I did not touch any keys on my keyboard)
(also, as Monoread pointed out, a red failure point would look more aesthetically pleasing)
One request I’d like to make is to expose a method for cleaning the path up - I had a look through the code but the CleanupPath function doesn’t appear accessible from outside the module.
I’m using a combination of controls in my current project, where the ClickToMove can be cancelled by moving your character with wasd keys. When this happens, the path is never deleted and I currently (save for forking the module) have no way to manually do so.