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: Checking if an item is above another item?

Previous Thread :: Next Thread 
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 04:52 AM
I'm making a game sort of like Miner's haven (a sandbox game) and i'm currently working on the baseplate script. Is there any way to check if a brick is in / or hovering over another part? Or do I have to do another and more ###### ####
Report Abuse
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 04:53 AM
###### ##### ### aaaaa I hate censoring
Report Abuse
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 04:54 AM
Gtg, i'll check responses when I get back.


Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
14 Apr 2017 04:56 AM
You can do a raycast downwards.


Capitalist atheist
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
14 Apr 2017 05:13 AM
No check the .Y component of position for both objects and the one with a greater .Y component is higher up.

for example something like

pos1 = part1.Position.Y
pos2 = part1.Position.Y

if pos1 > pos2 then
print("Part1 is higher up")
else
print("Part2 is higher up")

something along those lines :D

~ Taking scripting/building requests ~ PM if interested ~
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
14 Apr 2017 05:13 AM
If you want to check if it's hovering over another object you would cast a ray downwards.
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
14 Apr 2017 05:14 AM
No, he's asking for a check. He doesn't know the x and z to judge the y on, so he has to use raycasting.


Capitalist atheist
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
14 Apr 2017 05:15 AM
Alright then raycasting is probably the solution. I just read the title lol
Report Abuse
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 12:49 PM
Alright, I got the raycasting down. How would I check if the ray is in contact with the baseplate? Because right now it only creates a Ray which does nothing. while true do local ### # ######## script.Parent.MovementPart.CFrame.p ) wait() end
Report Abuse
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 12:50 PM
Oops, thats an old script and it got tagged. while true do local ### # ######## script.Parent.MovementPart.CFrame.p, (script.Parent.MovementPart.CFrame.lookVector) ) wait() end
Report Abuse
Xeavic is not online. Xeavic
Joined: 16 Jul 2015
Total Posts: 532
14 Apr 2017 12:53 PM
while true do
local ### = ########
script.Parent.MovementPart.CFrame.p,
(script.Parent.MovementPart.CFrame.lookVector)
)

wait()
end


the hashtags is the local raycast


Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
14 Apr 2017 07:10 PM
To raycast downwards: local ### # ############################################# --Second argument is going down 500 studs local hit,pos,normal = workspace:FindPartOnRay(ray,brick,false,true) Capitalist atheist
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
14 Apr 2017 07:11 PM
Hashtags are basically
ray dot new
brick dot position
and
vector3 dot new zero negative five hundred zero


Capitalist atheist
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