|Topic was automatically imported from the old Question2Answer platform.
Is it possible to set an area2d as static or something so you can’t enter it? Thanks
don’t think so, why not just put a static body on top of it? what exactly is the context here?
zen3001 | 2021-02-05 16:47
I am making a top down game with a z axis I programmed in, and so if there is a platform, you need to be able to collide with it if you are not above it, however you need to be able to go into it if you are above it, it’s complicated. Luckily I figured it out and now have a working z axis!
djmick | 2021-02-06 01:10
just for the rest of people in that case all you need to do is make the platform a one way collision, you don’t need any area2d for that.
zen3001 | 2021-02-09 14:04
You can’t use a one way collision, as direction actually has nothing to do with it, in fact you need to be able to collide with it from all directions, but also pass through it from all directions. Remember, this is a top down 2d game that I programmed in a z axis for. What I had to do was make all platforms and entities an area. The entities had a ray cast that points in the direction they are moving, and if it collides with a platforms, I make two arrays, one for the entity, one for the platform with every pixel from their base to their top on the z axis by taking their z position through their z position plus their height in pixels, then I intersect the arrays, and if one pixel overlaps and is the same between arrays, they should collide and the entity can’t move forward because it is not over or under the platform, but if the arrays don’t overlap, the entity can move forward, because even though the entities collider would be colliding with the boxes collider, it would be above or below it. Then from there, you have to see if the entity is above or below it, if it is below, it can pass through unless it jumps up to the height of the base of the platform, in which case it must collide because its head would on the top of the platform, but if it is above, it’s z floor, or the distance it falls to must be equal to the platforms base. Sorry that was so long lol, I kind of just started typing and kept going. If you did figure out a way to use one direction platforms for this though, that would be amazing.
djmick | 2021-02-09 23:40