- Home /
SteamVR rendering a realistic red dot sight
I was curious if I could make a red dot sight realistic in unity and how to do it.
Here is my idea so far in pseudo code:
Raycast from gun to find hit point on wall. Move dot to hit point. Raycast from mid-point of sight to dot (mid point is an object)
Public gameObject dot; Color color = null; If (the raycast between dot and glass meets the camera) { color = dot.GetComponent().material.color ; color.a = 1; dot.GetComponent().material.color = color ; } else { color = dot.GetComponent().material.color ; color.a = 0; dot.GetComponent().material.color = color ; }
//Making the dot appear the correct size:
var size : float = (Camera.main.transform.position - transform.position).magnitude; transform.localScale = Vector3(size,size,size) * something;
something is used to define the size
Not sure if this will work the way I want it to. Are there any easier ways?
Your answer
![](https://koobas.hobune.stream/wayback/20220612175319im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
[SteamVR Mixed Reality] Quadratic View Only Show Black Screen 2 Answers
[HELP] developing for the HTC vive on a Mac 0 Answers
How to get the direction my Steam VR controller is pointing? 0 Answers
HTC Vive controllers wont appear 0 Answers
Grabbing a handle in VR and rotating it like a crank? 1 Answer