Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | wetbadger |
I am using intersect_point inside of a physics process. intersect_point should return a list of Area’s and Bodies that the point is in contact with, called “intersections”. However, the function doesn’t seem to work with Area’s that are using a collision polygon with the build_mode set to Segements.
func _physics_process(delta):
MovementLoop(delta)
var player_pos = get_global_position()
#this only works with collision polygons with BUILD_MODE == Solids
var intersections = get_world_2d().direct_space_state.intersect_point(
player_pos, 32, [self], 0x7FFFFFFF, true, true)
if len(intersections) == 0:
#hide red text
get_parent().get_node("RichTextLabel").visible = false
else:
#show red text (only shows up if polygon uses build_mode Solids)
get_parent().get_node("RichTextLabel").visible = true
print("The center of the object is inside an Area2D!")
Here’s video of the phenomenon
The only difference between the Area’s is shown here.
^^^ doesn’t work
^^^ works