- Home /
Question by
sethuraj · Mar 06, 2014 at 12:26 PM ·
touchtouchscreen
Keyboard to Android Touch Conversion...
This is not a question,this is a request.I have this code which is for pc keyboard.Can any one convert this to android touch without changning the logic.The DirectionInput is an Enum
//Function to update key inputs
void UpdateKeyInputs()
{
if(Input.anyKeyDown)
{ActiveInput=true;}
if(ActiveInput && !CheckSideCollision)
{
if(Input.GetKey(KeyCode.A))
{
DirectInput= DirectionInput.Left;
ActiveInput=false;
}
else if(Input.GetKey(KeyCode.D))
{
DirectInput= DirectionInput.Right;
ActiveInput=false;
}
else if(Input.GetKey(KeyCode.W))
{
DirectInput= DirectionInput.Up;
ActiveInput=false;
}
else if(Input.GetKey(KeyCode.S))
{
DirectInput= DirectionInput.Down;
ActiveInput=false;
}
}
else
{
DirectInput= DirectionInput.Null;
}
}
Comment
Yes i have pick this code well i have to try the keyboard andriod touch .. thats wonderful..!
Your answer
Follow this Question
Related Questions
Zoom in on tapped point in 3D space 1 Answer
Ray from a cube to a touch point to help aiming 0 Answers
Touch and release type of controll in Unity (Android). How to make it? 0 Answers
Shump Touch Control 1 Answer
Build an text editor in unity 3d 0 Answers