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
 

Adjusting raycast accuracy?

Previous Thread :: Next Thread 
Plurf is not online. Plurf
Joined: 11 Dec 2012
Total Posts: 5
27 Dec 2014 07:02 PM
Do I have to use some type of equation to do this?
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
27 Dec 2014 07:04 PM
It's pretty easy. Just add a "spread" feature to it. No, you don't need an equation.
Report Abuse
Plurf is not online. Plurf
Joined: 11 Dec 2012
Total Posts: 5
27 Dec 2014 07:32 PM
I added a spread and now I have multiple rays?
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Dec 2014 07:34 PM
You shouldn't have multiple rays if you did it correctly.

something liek..

local spread = 10

local ray = Ray.new(
startVector,
endVector * Vector3.new(spread * .6)
)
Report Abuse
Argelius is not online. Argelius
Joined: 19 Jul 2010
Total Posts: 4047
27 Dec 2014 07:37 PM
Yes you do need an equation

This is from a really old script I didn't make:
spread = 0.5
local rndm=Vector3.new(math.random(-(spread/10)*mag,(spread/10)*mag),math.random(-(spread/10)*mag,(spread/10)*mag),math.random(-(spread/10)*mag,(spread/10)*mag))
local dir=(mouse.Hit.p+rndm)-startpoint

Notice how the rndm vector (spread) is added to mouse.Hit.p.
Report Abuse
Plurf is not online. Plurf
Joined: 11 Dec 2012
Total Posts: 5
27 Dec 2014 07:41 PM
When I do that I get an error.

Ray length must be <= 1000.000000
Report Abuse
Plurf is not online. Plurf
Joined: 11 Dec 2012
Total Posts: 5
27 Dec 2014 07:42 PM
The above response was meant for goul
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Dec 2014 07:42 PM
Lol that is a lot of math for no reason. Just do something simple like I said..
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Dec 2014 07:44 PM
What the hell is that?
local spread = 10
local spreadVector = Vector3.new(math.random(-spread, spread), math.random(-spread, spread), math.random(-spread, spread))

and then add that on to your endVector
Report Abuse
Plurf is not online. Plurf
Joined: 11 Dec 2012
Total Posts: 5
27 Dec 2014 07:48 PM
Still getting more than one ray when unequipped.

ray = Ray.new(Tool.Handle.CFrame.p , ((mouse.Hit.p - Tool.Handle.CFrame.p) .unit+ Vector3.new(math.random(-1,1) / 70,math.random(-1,1) / 70,math.random(-1,1) / 70 ))*300)
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