|
| 31 Jul 2017 06:22 PM |
| How do I start a ray from the player's camera?. Simple question |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 31 Jul 2017 06:25 PM |
| i entered "#####################################################" into roblox and got an error... Why? lol |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|