![]() ![]() There is also a more advanced ‘surface normal’ variable that can be added and is probably way to complicated for what you want from raycasting. Local part,position = workspace:FindPartOnRay(ray, parts to ignore) You can also use this method to get the Vector3 value in the place that the ray hits an object This can be done by adding the variable position into the above function: If it doesn’t hit anything, part will be nil. What this does is it finds the part that the ray has hit. Local part = workspace:FindPartOnRay(ray, parts to ignore) If you wanted to find a part that the ray hits, you would use another inbuilt function: This would create an invisible ‘beam’ that can be used to hit parts and return true. Ray.new(Vector3 origin, Vector3 direction) The way that you create a ray is by using the inbuilt function: They can be used for anti-exploit purposes for checking whether a player is fly hacking or to create ranged weapons. Rays are a very interesting part of Roblox because they can be used for many different purposes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |