Author Topic: Check if vector collides with the top of a surface  (Read 1050 times)

how would I check if a vector collided with the top of a surface ($TypeMasks::FxBrickObjectType or $TypeMasks::TerrainObjectType)

do a container raycast, get the first brick it touches, do some math based on the brick.getWorldBox() function and figure out if the vector would be within the bounds of the top of the surface at the height that that surface is at.

For a terrain object type (why are you using this), if it finds some terrain you already know the vector has touched the top surface

do a container raycast, get the first brick it touches, do some math based on the brick.getWorldBox() function and figure out if the vector would be within the bounds of the top of the surface at the height that that surface is at.

For a terrain object type (why are you using this), if it finds some terrain you already know the vector has touched the top surface
Lol just realized there would be no purpose to checking for terrain because its just 1 big flat surface

do a container raycast, get the first brick it touches, do some math based on the brick.getWorldBox() function and figure out if the vector would be within the bounds of the top of the surface at the height that that surface is at.

For a terrain object type (why are you using this), if it finds some terrain you already know the vector has touched the top surface
getWorldBox doesn't include rotation, just be aware of this

getWorldBox doesn't include rotation, just be aware of this
This shoudn't be an issue because I'm checking for bricks

This shoudn't be an issue because I'm checking for bricks
It may if they aren't square shapes.

It may if they aren't square shapes.
Really? Can you give an example?

Really? Can you give an example?
wedge bricks, I suppose

If something like that really matters, you could use something easy like paint particle detection

wedge bricks, I suppose

If something like that really matters, you could use something easy like paint particle detection
I'm having trouble understanding how a brick would rotate so its top was no longer the top....

I'm having trouble understanding how a brick would rotate so its top was no longer the top....
mspaint to the rescue!

mspaint to the rescue!

I only want to find the flat horizontal top parts no slanted

I only want to find the flat horizontal top parts no slanted
that's a top view

that's a top view
oooooooooooooooooooooooooooohhhh, ya I don't think it would matter

Really? Can you give an example?
Anything that isn't 1x1, 2x2, etc.

For instance, 2x4 bricks.

Anything that isn't 1x1, 2x2, etc.

For instance, 2x4 bricks.
but bricks won't be rotated ever, so it shouldn't matter unless it's an irregular shape