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
 

Re: Calculating a region based on a Ray's vectors

Previous Thread :: Next Thread 
InnovatedFighting is not online. InnovatedFighting
Joined: 30 Oct 2014
Total Posts: 1040
20 Apr 2016 01:51 AM
I am attempting to create a region that is based off of a ray of two positions. The ray can be in all directions and has no limit to length. I wish to create a region around the ray that encompass the area 5 studs away from the ray in all directions.

However I have no idea on how I could get the vector3s for the region from the start and end vectors of the ray. I'm sure there is a solution but how?

In an attempt to understand the idea more I created this model as a frame, https://www.roblox.com/Pos-item?id=401537545 the red part would be the ray, while the black parts represent the vectors for the region and ray. Hopefully it makes sense(named the parts to what they represent)

Thank you in advance, if I need to specify more please tell me.





Report Abuse
InnovatedFighting is not online. InnovatedFighting
Joined: 30 Oct 2014
Total Posts: 1040
20 Apr 2016 09:40 PM
b1


Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
20 Apr 2016 09:46 PM
I'm pretty sure Region3's can't have a rotation.
Report Abuse
InnovatedFighting is not online. InnovatedFighting
Joined: 30 Oct 2014
Total Posts: 1040
21 Apr 2016 04:20 PM
Oh yeah, forgot about that.

How else could I do something like this? In my end product I want to get all players inside of a 5 stud radius or so from a ray.


Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
21 Apr 2016 04:28 PM
To figure out if a point P is within 5 studs of a ray:

Find the line which the ray lies on.
Find the closest point on the line from the point P.
If that closest point is within 5 studs of P, then the condition is met.
Otherwise, if the point P is within 5 studs of the endpoints of the ray, the condition is also met.

http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
21 Apr 2016 04:29 PM
Oh wait the closest point to P also needs to be on the line segment that is the ray.
Report Abuse
InnovatedFighting is not online. InnovatedFighting
Joined: 30 Oct 2014
Total Posts: 1040
21 Apr 2016 05:17 PM
How would you find the closest point on the line to P though?

Right now the only thing that comes to mind would be to find equation of the line, then find the perpendicular line from the player and the ray, then see if thats 5 studs or larger, so could try and see if I could do that.

Unless theres an easier way to do that?


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