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
 

Raycasting question.

Previous Thread :: Next Thread 
OakBerry is not online. OakBerry
Joined: 18 May 2015
Total Posts: 407
03 Oct 2015 03:04 PM
Okay, so I tried to learn ray casting yesterday and I did this:

local Ray = Ray.new(Player.Character["Right Arm"].Position,(Player.Character["Right Arm"].Position - Mouse.Hit.p).unit * 500)

local Hit = workspace:FindPartOnRay(Ray)

And whenever I print Hit, it gives me the wrong information. Let's say I have my mouse on top of baseplate, it says nil. If I point my cursor towards the sky it says "HumanoidRootPart", or something like that. Why? Also, what it he unit * 500 for?
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
03 Oct 2015 03:16 PM
Do this instead:

Mouse.Hit.p - Player.Character["Right Arm"].Position,(Player.Character["Right Arm"].Position

And add the player's character to the ignore parameter:

workspace:FindPartOnRay(Ray,Player.Character)
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
03 Oct 2015 03:17 PM
Whoops, here:

Mouse.Hit.p - Player.Character["Right Arm"].Position
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