Forum Discussion
nigrin
12 years agoExplorer
[TIP] Detecting where the player looks at
Hi guys, we came across this for our vrjam game "Sorcerer's Wrath", where the player fights things by just looking at them. Here is a quick blog post how we did this, I have not seen this specif...
vajra3d
11 years agoHonored Guest
Does the cube have a collider attached to it? In order for the ray to detect an object in the scene it must have a physics collider component (box, capsule, mesh...) attached to it. That should do the trick.
Also, if you want it to display the name of the object it hits then add something like this to your code:
print (hit.collider.name);
or
print (hit.collider.gameObject.name);
also, if using tags:
print (hit.collider.tag);
Hope that helps!
Also, if you want it to display the name of the object it hits then add something like this to your code:
print (hit.collider.name);
or
print (hit.collider.gameObject.name);
also, if using tags:
print (hit.collider.tag);
Hope that helps!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 9 months ago