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: Can someone explain what a raycast is?

Previous Thread :: Next Thread 
ThatKidYoshi is online. ThatKidYoshi
Joined: 21 Jul 2016
Total Posts: 146
12 Sep 2017 08:35 PM
Not sure what it is, I keep hearing it in high level scripting conversations.
Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
12 Sep 2017 08:39 PM
Its not really high level

http://wiki.roblox.com/index.php?title=Raycasting

http://wiki.roblox.com/index.php?title=Raycasting_Basics



local raycast = Ray.new(
startposition, -- where the raycast starts, point a
endposition -- where it raycast ends, point b
)
local parthit = Workspace:FindPartOnRay(raycast) -- parthit is the object the ray hit.


if parthit then -- check if parthit exists (ray actually hit something between point a and b)
print(parthit)
end


attempt to index global 'soul' (a nil value)
Report Abuse
EncodedLua is online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
12 Sep 2017 08:45 PM
^

discord.gg/fissy Scripters' Academy Discord (just starting up): discord.gg/VrbkYPs yeah yeah multiply that math.random by the vector3 to get the cframe and use them htmls to bypass the mainframe of the mysql yeah
Report Abuse
kennydies is online. kennydies
Joined: 15 Nov 2008
Total Posts: 825
12 Sep 2017 09:00 PM
sinister is wrong. the second argument in the ray constructor is a direction, not a position.


Report Abuse
EncodedLua is online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
12 Sep 2017 09:01 PM
true

discord.gg/fissy Scripters' Academy Discord (just starting up): discord.gg/VrbkYPs yeah yeah multiply that math.random by the vector3 to get the cframe and use them htmls to bypass the mainframe of the mysql yeah
Report Abuse
kennydies is online. kennydies
Joined: 15 Nov 2008
Total Posts: 825
12 Sep 2017 09:02 PM
Oh, and since nobody really provided an explanation of what raycasting actually is:

Effectively you're shooting a beam from a position in a certain direction to see what it hits. It's useful for stuff like guns where you want to shoot towards the mouse to see if the player clicked on another player, and thus you need to damage them.


Report Abuse
OAuth2 is not online. OAuth2
Joined: 27 Nov 2016
Total Posts: 751
12 Sep 2017 09:29 PM
The second argument for Ray.new isn't the end position, but a direction. If you want to get the direction of where your mouse hits:
(Mouse.Hit.p - Camera.CFrame.p).unit * distance
Report Abuse
EncodedLua is online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
12 Sep 2017 09:31 PM
oh my god what an og namesnipe

discord.gg/fissy Scripters' Academy Discord (just starting up): discord.gg/VrbkYPs yeah yeah multiply that math.random by the vector3 to get the cframe and use them htmls to bypass the mainframe of the mysql yeah
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