Directional and Point And Click navigation

Zac 6 months ago in Game Creator updated by Marti (Lead Developer) 5 months ago 7

First off, like many others, thank you for developing these tools. You are really making high-quality tools for people to start game developing without having to build the basics. This helps beginners like me.

Is it possible to have a combination of the Directional and Point And Click navigation player inputs? I'm looking to control the player with both methods; if a player clicks to move, they can cancel their direction by moving by navigation keys. Likewise if moving but then click a location, the nav mesh will take the player to the clicked location.

I did some snooping in the code and it appears LocomotionSystemDirectional and LocomotionSystemTarget would need to be combined. Very roughly, this seems like the best way to go about this?   

public override Update()


    // Grab input (ie. this.desiredDirection - from LocomotionSystemDirectional)

   // If this.desiredDirection is non-zero, get the NavMeshAgent, stop it

   // Move player based on input (ie same code from LocomotionSystemDirectional)

   // else if this.desiredDirection is zero, and if NavMeshAgent.pathPending, then move player


Unity version:
2018.4.20f1 Personal
Game Creator version:
Under review

Hi Zac;

Thank you for your kind words :-) At the moment, there's no way to allow that out of the box. These LocomotionSystem classes handle, as you have correctly spotted, how the character moves. However, there can only be one type active at a time.

Looks like you know a bit of coding, so here are the steps I'd take to do this:

What I would probably do is to set the LocomotionSystemDirectional type by default, and only change it to LocomotionSystemTarget when the user presses the mouse button. In that case, make the character move to the desired position and, once it reaches the destination, turn back to the LocomotionSystemDirectional.

Hope this makes sense!

Thank you for your response.

I took some time to look at the underlying classes you wrote, are you suggesting that a script be attached to the player to accomplish what you describe above? I feel that is the intention behind your suggested solution.

Ah, yes I think I see what you mean, I may have a code change to support changing the locomotion that you may consider adding as a fix for those who also need it. Please stay tuned.

Can you consider now adding this code to your PlayerCharacter.cs script, so that we can change the LocomotionType in code?

public void UpdateLocomotion(INPUT_TYPE inputType)
    this.inputType = inputType;

No need for that :-) The inputType is a public variable modifiable from outer scripts. You can simply do:

myPlayer.inputType = INPUT_TYPE.Directional; // or any value



Even better, you can consider this as closed - thank you for your time! :)


You're welcome! :-)