Is it possible to move and rotate the camera attached to a body using the GUI?
void OnGUI()
{
if(GUI.RepeatButton (new Rect(400,400,30,30),"^"))
{
transform.Translate ( Vector3.forward * Time.deltaTime * MovementSpeed, transform );
}
if ( GUI.RepeatButton ( new Rect ( 430, 430, 30, 30 ), ">" ) )
{
transform.Rotate ( Vector3.up * Time.deltaTime * CameraRotateSpeed );
}
if ( GUI.RepeatButton ( new Rect ( 370, 430, 30, 30 ), "<" ) )
{
transform.Rotate ( -1 * Vector3.up * Time.deltaTime * CameraRotateSpeed );
}
if ( GUI.RepeatButton ( new Rect ( 400, 460, 30, 30 ), "|" ) )
{
transform.Translate ( -1 * Vector3.forward * Time.deltaTime * MovementSpeed, transform );
}
}
This works properly. But the trouble is that the object passes through walls with Colliders. Is it possible to convert a GUI action into a Input.getAxis() so that I can use it directly in Character Controller?
I want to disable the Keyboard and Mouse Input for moving and rotating the object and Instead just make it move using the GUI buttons.
Any help is appreciated.