On the Camera:ViewportPointToRay page the second code example to create a longer ray uses :ScreenPointToRay
, this code example is exactly the same example shown on the Camera:ScreenPointToRay page.
On the ScreenPointToRay
page, the matching example for creating part 1 stud in front of the camera causes the camera to jump forward because the part is in the way, making it appear the part was created behind the camera as shown below.
I would suggest making the part slightly further from the camera to avoid this, here is an example at 5 studs away from the camera.
The code for this also uses the mouse object has been superseded by user input service.