Hi guys,
I’m trying to make some changes to convert a small project to support mobile touch.
Currently I have a character with the keyboard options of wasd to move around.
Mouse click to left to shoot and right to dodge/move away from a enemy.
The issue is wasd have not been assigned specific keys but horizontal and vertical.
Please see sample script below:
if(SCR_input.cType==0){
if (planeHit) {
character.SetRotAngle(destination);
}
if(Input.GetMouseButton(1)){
dirPressed=true;
}
} else {
float inputX=Input.GetAxis("Horizontal");
float inputY=Input.GetAxis("Vertical");
if(inputX!=0f||inputY!=0f){
dirPressed=true;
Vector3 inputDir=new Vector3(inputX,0f,inputY).normalized;
character.SetRotAngle(transform.position+inputDir);
}
}
Does anyone have a simple solution or any ideas.
Initially I wanted small corner of the screen to have movement via just touch area in corner.
Clicking on screen makes player shoot which seems fine.
Will need a button to attach the dodge for.
BTW I did not code this but its part of a bought asset and style is different to the usual controls mechanism I have encountered.
Thank you