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 |
|
|
| 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 |
|
|
| 03 Oct 2015 03:17 PM |
Whoops, here:
Mouse.Hit.p - Player.Character["Right Arm"].Position |
|
|
| Report Abuse |
|