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: How to do 2-dimensional raycasting?

Previous Thread :: Next Thread 
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:11 PM
hi all
is there any way to do a "raycast" across an entire axis? (without lagging/raycasting infinitely)

or some way to get around this? i want to detect if something is aligned with a part's axis...
if i'm being unclear PLEASE let me know, thanks :)
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:15 PM
CORRECTION:
not quite "aligned with a part's axis", but i mean
i want a "2-dimensional ray" to be cast from the player's torso to mouse.Target
Report Abuse
TheMesgi is not online. TheMesgi
Joined: 03 Mar 2012
Total Posts: 360
12 Jul 2016 04:19 PM
https://www.roblox.com/games/454605004/TheMesgis-Place-Number-127

like in this place?
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:19 PM
imagine a "ray" being cast from the torso's cframe to mouse.Target
it would not only detect the object struck by the ray directly in front, but if it is ABOVE or BELOW the ray's Y axis, it strikes that object
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:21 PM
sorry if i'm being unclear, i feel like it's hard to explain
@megsi thanks for the suggestion but no :(
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:23 PM
Ok, imagine a player is standing on top of a ledge looking down.
At the bottom of the ledge, there is a special part that the script wants to detect for and NOT ignore.
If the player clicks ABOVE or BELOW it, it strikes the object but if it looks LEFT or RIGHT it doesn't register.
Report Abuse
TheMesgi is not online. TheMesgi
Joined: 03 Mar 2012
Total Posts: 360
12 Jul 2016 04:25 PM
oh i get it, but im not sure
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:25 PM
And what makes it a "ray" and not a condition-checker is that if there is something in the way between the angle (between the torso and the object) it will hit that instead
Is this even possible without rigorous crap that will lag?
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:39 PM
bump
O_O
Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:53 PM
wow
bump
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
12 Jul 2016 04:54 PM
kind of like a geometric plane?

maybe this can help you, didn't read through it much, not sure if it's what you're looking for or not

github/topameng/CsToLua/blob/master/tolua/Assets/Lua/Plane.lua


Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 04:56 PM
hmmm yeah a plane
but planes aren't possible in roblox (not true ones at least)
some workaround would be nice
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
12 Jul 2016 04:57 PM
check what's in that github, i think he's pulling it off


Report Abuse
PoptartNoahh is not online. PoptartNoahh
Joined: 06 Jul 2015
Total Posts: 11063
12 Jul 2016 06:46 PM
it took some reworking, but his script actually works...



...but it's not what i'm looking for
(although it has some cool ideas and methods that may help)
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
12 Jul 2016 07:04 PM
If you want to know if a player is above or below a certain part, just use the player's height and the part's height? Or isn't this what you are looking for?
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
12 Jul 2016 07:13 PM
Aah wait I know what you mean.

Just check if the player's X and Z positions are between the borders of this brick.

Example:

Player: (5,4,6) X Y Z
partposition: (3,2,7)
partsize(10,2,10)

playerinrange?
X: 3 - 5 <= 5 <= 3 + 5 (Border of part is middle +- half of size)
Z: 7 - 5 <= 6 <= 7 + 5
--> player above/under part.
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
12 Jul 2016 07:15 PM
@Error9999 WIthout taking into acount if the object is a mesh, a non cubish shape, and is rotated in a certain way? Ew.
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
12 Jul 2016 07:19 PM
I only just came back to roblox...

I didn't even know you could make meshes now :(

But lets just assume the part is a normal brick without any rotations :)
And I typed all that stuff using my phone, so better not spoil it for me :s
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
12 Jul 2016 07:30 PM
if you wanna know a ALL parts that are located on a certain axis, you could always organize all part's positions (axis) within the workspace into a table. Example for sorting the Y axis:

ExampleWorkspace = {workspace.Part,workspace.Part1,workspace.Part2.workspace.Part3,workspace.Part4}
SortedPosY = {}


for i,v in pairs(ExampleWorkspace) do
local Y = v.Position.Y
if SortedPosY[Y] then
table.insert(SortedPosY[Y],v)
else
SortedPosY[Y] = {v}
end

end

print(SortedPosY[1]) --would print a table with objects located at Y: 1
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