![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Schazzwozzer |
Hello! I’m starting to tinker with Godot’s geometry capabilities, and I’ve immediately run into a problem: I can’t get intersect_point to work.
I’ve got a very simple scene: an Area2D with a corresponding CollisionShape2D. A Sprite so that I can visualize the area. Another Sprite which I can move around (using a simple control script), and which serves as the “point” against which I am testing for intersection.
The script is similarly simple and pretty closely inspired by this raycast guide. This function is executed from _physics_process
:
func check_intersection( position : Vector2 ):
var intersections = get_world_2d().direct_space_state.intersect_point( position )
for i in intersections:
print( "Intersection: " + intersections[i] );
The “position” Vector2 parameter is the global_position
of my “Position Test” node.
So, when I move the “Position Test” node into the Area2D, I would expect it to print something to the console… but nothing happens. I feel like I’m missing something obvious or I’ve made some small mistake. Help!