generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do i start a ray from the player's camera?

Previous Thread :: Next Thread 
gaberocksall is not online. gaberocksall
Joined: 23 Apr 2016
Total Posts: 207
31 Jul 2017 06:22 PM
How do I start a ray from the player's camera?. Simple question
Report Abuse
Niveum is not online. Niveum
Joined: 15 Aug 2009
Total Posts: 3437
31 Jul 2017 06:23 PM
local cam = workspace.CurrentCamera local ################ # ################################################ Thatll cast a ray from the cam in the direction its looking ~ S P I C Y ~
Report Abuse
gaberocksall is not online. gaberocksall
Joined: 23 Apr 2016
Total Posts: 207
31 Jul 2017 06:25 PM
i entered "#####################################################" into roblox and got an error... Why? lol
Report Abuse
raik220 is not online. raik220
Joined: 13 Jun 2011
Total Posts: 241
31 Jul 2017 06:27 PM
To get the position of the players camera use the "CFrame" property of it. local cam = workspace.CurrentCamera local RANGE = 10 local Vec3 -- the vector you want the ray to point at local ################ # #################################################### local hit,pos = workspace:FindPartOnRay(ray)
Report Abuse
Bobbrige is not online. Bobbrige
Joined: 27 Jul 2010
Total Posts: 411
31 Jul 2017 06:28 PM
the answer is buried somewhere in here
http://wiki.roblox.com/index.php?title=API:Class/Camera/ScreenPointToRay
Report Abuse
raik220 is not online. raik220
Joined: 13 Jun 2011
Total Posts: 241
31 Jul 2017 06:30 PM
I guess ROBLOX didnt like my reply, here is the ######## /km7HPXY0
Report Abuse
Niveum is not online. Niveum
Joined: 15 Aug 2009
Total Posts: 3437
31 Jul 2017 06:30 PM
~Tags begone~

local camera = game.Workspace.CurrentCamera
local RayCast = Ray.new(camera.CFrame.p, camera.CFrame.lookVector * 1000)

the first argument in "Ray" is the starting position, the second argument is the direction you want your ray to look. The 1000 is how far you want it to stretch out, but is specific to vectors in this case.


~ S P I C Y ~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image