Thats not what I’m looking for.
I know how to raycast
I’m trying to raycast a part like legit the part itself
I just don’t wanna use touched but I probably will if I can’t figure it out
I want to raycast a line basically from the part position to the end of the part
That’s exactly what the link teaches. workspace:Raycast raycasts from the first parameter, and moves in the direction of the second. workspace:Raycast(rayOrigin, rayDirection)
That said, I can’t explain why you might be having issues.
I’m looking for basically a raycast to cover a part so anything that is inside the part is incased and will return a result. So yeah I was kind of confused why it didn’t work so I decided to ask about it.
For example:
--------------Object------
Since it is in the line it should return the object
but what happens is that it only returns it if its directly straight from where the point is and only a bit left or right.
If you go very far right or left you can still be in the part but it won’t return anything
Also don’t want to raycast directly to the character as that makes the part undodgeable it’s going to be used for something that should be dodgeable but it does work
I’m not sure how @Tomatoe_s solution doesnt work but another way is to use the parametric line equation and only give positive values of t. It basically returns a point on a ray (assuming t is positive). Just make sure the direction is defined as the difference of the two vertexs, eg: direction = rayOrigin - objectPosition
for i=1,100 do
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Position = rayOrigin + (rayDirection.Unit * i)
part.Parent = workspace
end
Yeah sorry this probably won’t work either but what I figured out is that I can put two parts make them invisible parts raycast them and that should work
So yeah I tested it with what I thought and it actually worked very well thanks for the responses though