Send ray in a the orientation of a part

there is no orientation property of rays (i think) how could i do it in a diffrent way something like this
image

1 Like

I recommend raycasts, but to send a ray in the direction of a part just use
Part.CFrame.LookVector * 10000
10000 being the range of the ray

1 Like

also how can i make a part that highlighs the direction of the ray

1 Like

the ray doesnt detect if a baseplate is in the way or a character

1 Like

the rayOrigin line errors because you can’t create a Vector3 using a CFrame because the Vector3.new() constructor expects 3 parameters being the x-y-z components which are numbers and not Vector3s or any other


rather you can get the Vector3 position of a CFrame using CFrame.Position
Screenshot 2024-01-02 173657

so the code should be

local rayOrigin = workspace.Part.Position -- this is the same as workspace.Part.CFrame.Position
local rayDirection = workspace.Part.CFrame.LookVector * 100

local raycastResult = workspace:Raycast(rayOrigin, rayDirection)
2 Likes

thanks but i already fixed it when you were writing this but still thanks for helping me! :>
image

1 Like

then what did you do to fix it, I’m curious

1 Like

i dont rember the code is messy sorry i havent used raycasts before

1 Like

also this post should be in #help-and-feedback:scripting-support

1 Like

how about screnshotting the script again

also im new at using devforum this is my 2nd post


it paints the part the ray hits

2 Likes

you can still move the post to #help-and-feedback:scripting-support and next time if you need help with a script post it in #help-and-feedback:scripting-support and not on #development-discussion

oh. sorry as i said before this is my second post

1 Like

the rayOrigin line is the same as my solution, i guess that technically means i kinda solved it lol

i understand, i hope you learned from your mistake and i believe you can still move this post to #help-and-feedback:scripting-support

1 Like

how can i do that?

doneeeeeeeee

1 Like

does this show up to you when you edit the post?

2 Likes

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