- Home /
Question by
Kaonasz · Mar 28, 2019 at 06:03 PM ·
raycastcollideraudiosourcefirst-person
How to make the raycast go from global to global positions?
The raycast I make goes only by "addition position"(or something local) from starting point. The problem is with PlayerListener.transform.position or PlayerListener.transform.localPosition I tried both of them..
scr.png
(7.6 kB)
Comment
Best Answer
Answer by jstopyraIGG · Mar 28, 2019 at 06:24 PM
the raycast takes the start position, and direction. You should write
//PlayerListener.transform.position - transform.position = direction from transform.position to PayerListener.position
Physics.Raycast(transform.position, PlayerListener.transform.position-transform.position, out hit)
Your answer
![](https://koobas.hobune.stream/wayback/20220612194447im_/https://answers.unity.com/themes/thub/images/avi.jpg)