Godot Version
Godot 4.3
Question
I made a astar map, draw a tilemap to represent astar map’s path
and add collisions on tilemap
But when I use intersect_point method on my player node to find where player is, sometimes intersect_point can’t detect tilemap’s collision
In my scene, i create two CharacterBody2D node: player and chaser, both are using astar
map to moving, chaser chase player when player is moving, but sometimes problem above i talked about happen, especially when they get close or when they start moving after _ready() is execute
This is the method
var spaceState = get_world_2d().direct_space_state
var pointQuery = PhysicsPointQueryParameters2D.new()
pointQuery.collide_with_areas = true
pointQuery.exclude = nodes
pointQuery.position = pos
var result = spaceState.intersect_point(pointQuery)
print(spaceState)
var twoPoints = []
if result:
twoPoints = checkPointsOnAsPoint(pos, result)
I use this method in _physics_process