Create a raycast from a part that faces the part direction

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to create a raycast from a part and ends 10 studs (the ray cast fires according to the part direction)

  1. What is the issue? Include screenshots / videos if possible!

I don’t know how to do it or at least what I knew does not work

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

cry😭

By part direction, do you mean the front of it? You can use the part’s CFrame LookVector for that, which is the direction its facing. Since it’s a normalized vector, you can multiply it by any number to extend it by n studs

workspace:Raycast(part.Position, part.CFrame.LookVector * 10)
1 Like

and what if i only can use position and not Lookvector?
Is it possible?

It’s not possible to get the direction of the part if you only have the position. Is there any reason you can only use the position?

maybe this post explain it better How to make a raycast pointing in the mouse direction with a certain lengh

Oh, I see that you want to get the direction from the part to the mouse. I’ll move on to that thread

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.