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
|
  |
| Joined: 16 Jul 2015 |
| Total Posts: 532 |
|
|
| 14 Apr 2017 04:53 AM |
| ###### ##### ### aaaaa I hate censoring |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 14 Apr 2017 04:56 AM |
You can do a raycast downwards.
Capitalist atheist |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 14 Apr 2017 05:15 AM |
| Alright then raycasting is probably the solution. I just read the title lol |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|