Author Topic: Is there a way to check if a brick is 'Grounded'?  (Read 989 times)

I've yet come across another problem, I need to know if a brick is touching the ground (aka the first brick at the bottom). I know how to check if it's a certain brick datablock, I just need to know if it's the first brick of the stack touching the ground and only if it touches the ground.

Any suggestions?

if(%brick.hasPathToGround() && %brick.getNumDownBricks() == 0)
{
code...
}

if(%brick.hasPathToGround() && %brick.getNumDownBricks() == 0)
{
code...
}


Thank you so much!

I did try looking on http://bldocs.nullable.se/html/ but I couldn't find anything, thank you!

Thank you so much!

I did try looking on http://bldocs.nullable.se/html/ but I couldn't find anything, thank you!

No problem. Always love to help when I can.

Actually, that would run even if the brick were supported by a brick above it. For example:



The green brick would be considered "on the ground."

So, what you actually want is actually a little more simple. if(%brick.getDistanceFromGround() == 0)

Actually, that would run even if the brick were supported by a brick above it. For example:

[img width=250]http://i.imgur.com/Xdxr1DB.png[/img]

The green brick would be considered "on the ground."

So, what you actually want is actually a little more simple. if(%brick.getDistanceFromGround() == 0)
And this is why we don't lock help topics just because an answer was given.