Is there a way to get a node using the position data so that I can hide nodes that are covered

  • stranger_anger replied to this.
  • You could examine all the nodes in the scene tree, and compare their positions with a specified position.

    Based on the limited information you've provided, it's not possible to be more specific.

    The_Grass_man it sounds like you want to do collision detection.

    If you want to detect when nodes are in a general area, a collisionObject2D can be used. Each of the nodes you want to detect needs to be connected to the signal for colliding.

    Check out the official Godot tutorial "Dodge the creeps" for an example of an area2D detecting collisions with rigidbody2D s

      You could examine all the nodes in the scene tree, and compare their positions with a specified position.

      Based on the limited information you've provided, it's not possible to be more specific.

      The_Grass_man a simple thing to do is bounds checking, if you know the coordinates, you can easily check if something is close to them, or within the bounds.

      Subtracting two objects position vectors, taking abs value, and seeing if they are less than your threshold value works. You can ignore the vertical dimension, and just check the first 2 dimensions if you don't care about vertical distance.

      Since we're talking vaguely, you could have a moving 3d object like a big cloud. Maybe you want to hide nodes that go under the cloud.

      Every Node could do ray casts upwards as the move along the ground and hide themselves if the rays collide with the cloud.

      Or more simply, have a 3d collision volume that is a cylinder which extends all the way to the ground. Attach it to the clouds and check collisions as they move around.

      Maybe you want to be able to click somewhere on the screen and hide everything on the ground near your click? Cast a ray from the camera, towards the cursor position, see where it hits the ground, move a collision volume there, and see how gets collided with.