HOW SWIPE THE CAMERA AND FOLLOW MY GUN WHEN I TOUCH MY MOBILE SCREEN

Hello Developers :slight_smile: ,

I’m new in Unity and i’m trying create shooting game… what i want is swipe camera up, down , left , right when touch my mobile screen and of course the camera should follow the gun when moving :slight_smile: …Also I’m using RayCast to hit an object so i hope RayCast hit direction follow the gun.

    RaycastHit hit;

        if ( Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range ) )
        {
            Target target = hit.transform.GetComponent<Target> ();
            if (target != null)



            {
                target.TakeDamage (damage);
            }


        }

ANY IDEA OR ANY BETTER IDEAS

Thank you so much

The Standard Assets have a few examples of this sort of controller.

1 Like

Hello,

Thank you for your reply …Please can you share with me any script to do what i want !!

Download the standard assets.

There you will find, in the CrossPlatformInput / Prefabs folder, several control rigs that may solve your problem.