According to the Camera.ViewportSize’s documentation, the ViewportSize
is the dimensions in pixels of the client’s viewport, so how come when I have a Camera
object and assign a ViewportFrame
's CurrentCamera
property to said Camera
, its ViewPortSize
is 1, 1
? Is this a bug or is there something I’m doing wrong? I think it being only 1 pixel is the consequential reason why I’m always getting nil
for raycasts within the ViewPortFrame.WorldModel
.
4 Likes
I figured it out a couple days ago, but I’ll share it here in case anybody else comes across this problem in the future. It appears that the Camera.ViewportSize
does not adhere to the documentation for cameras associated with ViewportFrame
objects. The 1, 1
for the ViewportSize
field actually means that it encompasses the entire scale of the ViewportFrame
's size instead of the number of pixels.
In short, this means that if you want to access a point from the Camera
's viewport to do a raycast at the center of the Camera
's viewport, you’d have to do it at point 0.5, 0.5
.
6 Likes