Hello, i’m trying to make a “arcade game” with a wiimote and the crosshair is a GUITexture.
I would like to know how to move the gameobject i use as weapon so it moves pointing to where the guitexture is located. I would also like to know how to make it shoot to where the texture is located.
You could think of it as this.
Your weapon, I assume like a gun.
Draw raycast from the barrel of the gun. Then you have some set distance as to how far it can shoot. This distance can be a collider of the plane. Then you find the point of where the raycast and the plane intersect. From there you take the normal of the intersection point and convert that into viewport coordinate. This sounds hard at first, but you will need to look up the docs for some stuff.
Raycast, HitRayCast, Normal, WorldToViewPort, or even ViewPortToWorld
Also, there is a unity tutorial which does just that as well. Check it out. Unity Asset Store - The Best Assets for Game Making