Is it possible to raycast or make something like a raycast that shoots out a limited length in the chosen direction without needing something to hit? I’m trying to make a levitation thing but I’m having problems limiting the position at which it gets pushed to when aiming my mouse into the sky.
1 Like
The length of the direction, (lookvector * unit), is the distance you are looking for. Any part/terrain further than it’s length will not be tested.
Yeah, but with raycasting it needs to hit a part to return a result.
If you want it to still return the position even when nothing gets touched, this will basically just return a position a certain radius out from the origin:
local ray = workspace:Raycast(origin, direction, params) or {Position = origin + direction}
2 Likes
You don’t need raycast to determine the position in any given direction. Simply use lookvector * unit.