Tag Info

New answers tagged

-1

Raycasting is what you want. As far as I know Minecraft uses raycasting aswell. How it works is basicly, that you send a "ray", represented as a 3D vector from the middle of your camera. The voxel you look at then is the first one the ray " collides with. ThinMatrix made a tutorial on ray casting.


0

As already stated you should move to physics raycasts as they allow for greater debugging with on click events. Your problem with the raycast is mixing Unity's 2DPhysics with 3DPhysics calls. If you want to Raycast to an object with 2D physics components you must use. Physics2D.Raycast. The code below should help you find what is obscuring your collider. ...


1

If I am understanding the question correctly, you just want the delta mouse when you are in relative mode. According to the docs, https://directxtk.codeplex.com/wikipage?title=Mouse&referringTitle=Home#Absolute%20vs.%20Relative%20Mouse%20position When you query the state of the mouse, the x and y coordinates return the delta. Note, because you ...


0

Attach a button component to your image after create a script with a public function (any name) then attach your script to any game object, add this game object to the button component and call the function.


0

You can use a RayCast: Ray ray = Camera.main.ScreenPointToRay( Input.mousePosition ); RaycastHit hit; if( Physics.Raycast( ray, out hit, 100 ) ) { Debug.Log( hit.transform.gameObject.name ); }



Top 50 recent answers are included