I want to get the value of the z axis for ray tracing
I only have the X and Y value but i dont know how to get the z value without making the display into a box
I tried many equations to make it work correctly but the best i got is the fov being uneven
how it looks like using x y and my equation of z
how it looks like using only x y and the value of z is 0
on the z axis
for x = 0, screensize do
for y = 0, screensize do
-- task.wait()
-- for z = 0,screensize do
local z = (x + y) - y
local part = Instance.new("Part")
part.Size = Vector3.new(size,size,size)
part.Position = Vector3.new(x * size,y * size + offsety,0)
part.Anchored = true
part.Parent = workspace.Grids
--for z = 0, screensize do
partmenu[part] = {part,x,y,z}
-- task.wait()
print(partmenu[part][4])
--end
--end
end
end
the same script in the portion i gave you its just getting the information for the ray cast they ray cast is being casted from the gray part not the parts just the one gray part
okay so why not fire the raycast from the grey block, and put a part in your script which detects when it hits something and with that you can get RayResult and use RayResult.Instance.Position.X etc
local rayOrigin = Vector3.new(0, 0, 0)
local rayDirection = Vector3.new(0, -100, 0)
local raycastResult = workspace:Raycast(rayOrigin, rayDirection)
change the direction to the part that is firing the cast and using the axis of that part which you want to use and also change origin to the part that is firing it
i didnt mean it like that the portion of the script i gave you is making a screen to display whats happening and the raycast will be based off the position of every part of the display
the square is whats displaying and the points is what its hitting i want it to be hitting like this
im trying to make a raytracing system but i cant find the value of z and i only have y and x values
in the loop i shown x and y values are based off the screen and they x and y values basically describe where the ray will go but i dont have a value for z that will work correctly