This is my first post here on the forum. I apologize if my questions are uninformed or a repetition of commonly asked questions, but here we go:
I have been playing around with point&click movement, and before I decided to try AC, I had been working on a smooth kind of point&click using the Unity NavMesh, where a new destination raycast was sent continually when holding down the mouse button.
This type of movement is inspired by RPG games such as Diablo, Nox or Divinity.
I am trying to recreate this using AC, but with my limited programming experience, I haven't figured out how the AC scripts are composed, and I can't find the specific line where navigation destination is set with the mouse.
I still want to retain the "move to destination", but limit it to a quick mouse "tap", so I have both:
click-and-hold = continual movement (interrupted on MouseUp)
click once/tap = traditional point&click
How do I proceed on this issue?
Comments
Player movement calls are made in the PlayerMovement script, though writing a custom motion controller should be done through a separate script - see this tutorial.
However, what you are seeking should already be possible by setting your Movement method to Straight To Cursor in your Settings Manager - see Section 2.6 of the Manual.
The Player will then move towards the cursor whenever the mouse button is held. Additional options under the Movement settings panel further down will then allow traditional point-and-click: Single-clicking also moves player? and Pathfind when single-clicking?.
One is the ability to use Pathfinding continually, not only limited to single-clicking. In the game I'm working on, there will be some obstacles on the roads that are annoying if the player doesn't automatically pathfind around them.
With these issues, do you recommend that I instead try to implement my own custom motion controller, or is it possible for me to do it in AC without a lot of scripting?
The second issue may be resolved by modifying the "Click delay" value in the PlayerInput component's Inspector (it's on the GameEngine), but I doubt it. I will have to recreate your issue myself to see if it can be resolved.
Secondly, I am also trying to use the click-and-hold continuous movement. What I want is for the character to walk towards the mouse cursor when the button is held down, and if I move the mouse (while holding down the mouse button) the character should follow, like in Diablo.
I have set the Movement method to straight to cursor, but the character just moves to where the cursor was when I first clicked and held the button. It doesn't follow the mouse when I move it.
Did I miss something?
The Straight To Cursor method should allow the movement style you're looking for. Are you using v1.56b? Let's see the settings you have under the "Movement settings" panel in the Settings Manager. A screenshot posted on imgur.com will help to see what's going on.
So that we can eliminate the possibility of your player prefab being the cause of this, place in the 3D Demo game's Player prefab, Tin Pot, into the scene before running it to override your own. He can be found in /Assets/Adventure Creator/Demo/Resources.
After updating the asset to v.1.56c it works like a charm. Thanks again!