July 2017
Beginner to intermediate
390 pages
10h 53m
English
In the DirectX sample, we skipped the part where we test for interaction with other objects. We will, however, do this in our Unity code.
To do this, we have to use ray casting. Ray casting is a technique that allows us to examine whether the cursor hits an object or not. Imagine a ray of light coming out of the HoloLens, right from between your eyes. It will move straight into the distance. The moment it hits something, it will return and then you know that there is something out there that might be of interest. This is exactly how this works.
We will update our Update() code in Visual Studio:
private void Update() { if (cursor == null) return; var camTrans = Camera.main.transform; RaycastHit raycastHit; if (Physics.Raycast(new ...Read now
Unlock full access