0
Answered

Directional controls on wasd AND Tank controls on arrow keys ?

Dornano 5 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 9

Hi,

As mentioned in the title, I try to do both types of controls: Directional on wasd and Tank controls on the arrow keys.

First I made an On key down trigger with down arrow key, which leads to 2 Actions: Change Player direction to Target (and I set a position in front of the player) and Move Player to Transform (and I put an empty gameobject behind the character).

So when I press down arrow key, the character indeed steps back while looking ahead, but then he's stuck in this "strafe" mode, no matter which Action I put on the On key up trigger (cancel action, reset character state, stop gesture...)


And then, I figured out there was a Player Input action. Wonderful ! So I set it on tank controls, but when I press down, I'm still stuck on the strafe mode, I can't get back my directional moves like before. And I can't modify the tank controls by the way (like rotation speed etc.)


Sorry for the long message, I wanted to be as clear as possible.


Thanks a lot !

Unity version:
Game Creator version:
GOOD, I'M SATISFIED
Satisfaction mark by Dornano 4 months ago
Under review

I think you're overcomplicating things. Strafing is automatically handled when you set the character's direction towards an object. Tank controls, just to be clear, do not handle strafing. It changes the right and left arrow controls so they rotate the character, not make it move side-ways.

So in your case, I think you're looking for setting the player's Input to Directional. Nothing else.

If I misunderstood something, would you mind sharing a video with the problem? 

Sure, here is a quick video.

In fact, I don't want strafing, sorry for the misunderstanding.

I want Directional on WASD and Tank controls on up/down/left/right *in the same time*. 2 kind of controls, so the player can quickly switch from one to another depending on the situation.

On the video you can also see what Actions I put on my Inspector to make him step back, I don't know if you will find that useful.

Thanks for your help !


strafing issue

In that case, same way you set the Action to change the facing direction of the player, you can change the face direction to "Movement Direction" when pressing the WASD keys. That should solve the problem

Oh great, thanks ! He's not strafing anymore ^^

But now, weird stuff appeared...


1) So, on key up [down arrow], he's back to Directional moves. Great. But he also turn around and face the camera. I would like him to keep facing towards. I can't figure out where the hell this Player rotation is coming from...

Player look at camera after stepping backward.mkv

2) The weirdest is this. When I step back, the Player mysteriously starts to rotate on himself. As you can see on the video, I added an empty gameobject (called "while facing towards") in front of the Player to make him keep facing towards.

Weird rotation.mkv


3) But maybe the whole thing is not the good way to do tank controls, because I push down arrow key, he steps back only towards the camera (on this last video, I added an X offset to dirtily fix the weird rotation). I'm completely lost...

Not steping back.mkv

Answered

So when the character doesn't use tank controls, but the directional, you can simply use the "Character Direction" action and change it so the player faces the Camera Direction. This will make the character strafe and always look where the camera is looking at.

When using the Tank Controls, change the Character Direction to "Movement Direction", so you can freely rotate the character using the left and right arrows.

I've just tested, and yes, it's near what I was looking for :D
In fact, I've found the "Player movement input" Action: when the player hit up, down, right or left, it changes to Tank controls. Perfect !

Just one remaining thing: can we modify the parameters of these controls, inside the "Player movement input" action?

Either inside the Player character's Input and Advanced Properties or using the related Actions (Input and Character Direction).

Maybe there is a misunderstanding.

In my Player properties, sure, I can modify the parameters of my by default Locomotion mode, which is Directional, like here:


But when I add an Action which change the locomotion mode to Tank, I can"t modify any parameter, as we can see here:



It would be nice to have more options inside this "Change input" action.

I try to be as clear as possible, but don't hesitate to tell me if you need any more info or whatever.

Yeah exactly. Tank Controls basically change how the player moves using the WASD keys. A and D rotate the character and W moves him forward relative to its rotation. There aren't any options because the Tank Control doesn't have any others.

Not sure I fully understand the problem, sorry.