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 » Scripting Helpers
Home Search
 

Re: Raycasting.

Previous Thread :: Next Thread 
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:07 PM
How would I change which way the ray is pointing. I'm new the raycasting and I find is fairly hard to learn due to the lack of it's documentation.
local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(0,0,0),Vector3.new(100,100,100),nil)
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 02:14 PM
[ Content Deleted ]
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
17 Sep 2012 02:15 PM
I believe the second argument is the end direction in Ray.new. Change that.
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:17 PM
@script
Thanks, you didn't have the need to insult me.
It isn't documented well 6 lines of code is not nearly enough.
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 02:21 PM
[ Content Deleted ]
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:30 PM
You can't seem to help anyone with out trying to insult them.
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 02:33 PM
[ Content Deleted ]
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:34 PM
Could you quote where I was being ignorant?
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 02:35 PM
[ Content Deleted ]
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:39 PM
It's true, I can't find anything good and I still can't.

I have no idea, what the "x 180" part means on the end. Is 180 the angle? I have no idea how to return it's position. I'm trying it now and apparently it's position is nil, yet it can name the part. It only seem's to be able to find the part once I move the part.

All i'm attempting to do is return the distance between 2 parts.
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 02:40 PM
[ Content Deleted ]
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:42 PM
I have no idea, there's no documentation of how to control that either. (That I can find)
At the moment i'm trying to pull extracts out of similar scripts and learn from them. Which isn't working.
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:43 PM
Ignore that last post.
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:50 PM
pos = script.Parent.Position
local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(pos),Vector3.new(0,-100,0) * 500),nil)
print(p)


So the ray start point will be the position of the brick and the ray end point will be 100 studs downwards from the brick position and 500 studs wide right?
How come it's returning nil when there is clearly a part less than 100 studs under it?
Report Abuse
builderman1171 is not online. builderman1171
Joined: 27 Mar 2010
Total Posts: 1595
17 Sep 2012 02:51 PM
The first argument is the start point, whilst the second argument is the direction. so if my start point was Vector3.new(0,0,0), and my dir-point was Vector3.new(0,10,0), then my ray will point upwards.

-> Siggy pooped by the power of Ponies <-
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 02:58 PM
This is in a moving part by the way.
As it moves along I need it to return the part that is underneath it.

So far this is what I have, although I dont think the brick.Y - 10 isn't going to work.

while true do
wait(2)
brick = script.Parent.Position
local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(brick),Vector3.new(brick.Y - 10) * 5),nil)
print(p)
end
Report Abuse
builderman1171 is not online. builderman1171
Joined: 27 Mar 2010
Total Posts: 1595
17 Sep 2012 03:00 PM
Replace:

Vector3.new(brick.Y-10)

With:

Vector3.new(brick.X,brick.Y-10,brick.Z)

-> Siggy pooped by the power of Ponies <-
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 03:08 PM
Ugh, I'm fed up with it. That works but it doesn't return all the bricks. So like if there was a brick called part 2 and that was ontop of a brick called part 1 it would only return part 1 even though that was under part2..
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 03:16 PM
[ Content Deleted ]
Report Abuse
129K is not online. 129K
Joined: 23 Aug 2011
Total Posts: 19010
17 Sep 2012 03:25 PM
"you because your being ignorant."

you're*
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 03:28 PM
Okay forget all of that. This way is working.
How would I make the f ray look downwards at an angle, so like infront of it but down towards the floor. Would I use the cord's like (0, -80, 80)?


while true do
wait(2)
Bottom = script.Parent
local p, collision = Workspace:FindPartOnRay(Ray.new(Bottom.Position, Bottom.Position + Vector3.new(0,-700,0)),nil)
local f, collision = Workspace:FindPartOnRay(Ray.new(Bottom.Position, Bottom.Position + Vector3.new(0,0,80)),nil)
print(p)
print(f)
end
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 03:28 PM
[ Content Deleted ]
Report Abuse
ScriptOn is not online. ScriptOn
Joined: 22 Aug 2010
Total Posts: 10885
17 Sep 2012 03:29 PM
[ Content Deleted ]
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 03:30 PM
:/
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
17 Sep 2012 03:30 PM
So (0,-40,80)?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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