So my problem is that i’m trying to have a ray come out of a gun to detect what it hits but so far it just says it’s not colliding with anything which is weird because I set the position and direction to be in the direction the gun is pointing. Also the bullet is supposed to come out of the end of the gun and in the direction of the gun so I could use the bullet too for this, but using the bullet won’t work either. It just says nothing collides. Here is my code:
Thank you for your answer. I know how to get Origin like RaycastOrigin.Origin right, but how do I get its UnitVector again? Again thanks for helping me out.
You already have the unitvector! gun.CFrame.LookVector.Unit is the unitVector.
As it seems, its currently at 1. Your gun could only detect 1 stud away from the barrel. You should add a multiplier infront of it to enlarge the distance.
i.e. gun.CFrame.LookVector.Unit * 500 (to have 500 studs of range)
Sorry, but it says that Origin is not a valid member of RaycastResult. Did I do something wrong? Do you know how I can get the Origin for this as well? Thanks a lot.
Okay, now I can see the ray! Thank goodness! Thanks a lot, you wouldn’t believe how off this ray was! Almost different continents. Thanks so much, if I have any more questions i’ll ask here and i’ll try to see what’s going on in the code.
Hello, i’ve managed to get the direction right but the brick won’t grow longer, it’s just a little square stud that points in the right direction. Do you know how to fix this? Thanks.