You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
Describe the bug
A simple raycast does not wield a result when the Area2D is mirrored (meaning scale.x = -1)
To Reproduce
Steps to reproduce the behavior:
Create an empty Node2D scene and add a Area2D with a Rectangle shaped Collider
Add an Area2D, position x: 500 y: 100
Add a CollisionShape2D, size x: 200 y: 100
Add the following script to the Area2D for drawing debug data:
extends Area2D
var intersection_detected := false
func _process(delta):
var mousepos := get_global_mouse_position()
var space := get_world_2d().space
var space_state = PhysicsServer2D.space_get_direct_state(space)
var query := PhysicsRayQueryParameters2D.create(mousepos, global_position)
query.collide_with_areas = true
query.collide_with_bodies = false
var result := space_state.intersect_ray(query)
intersection_detected = not result.is_empty()
queue_redraw()
func _draw():
if intersection_detected:
$CollisionShape2D.shape.draw(get_canvas_item(), Color.YELLOW)
else:
$CollisionShape2D.shape.draw(get_canvas_item(), Color.WHITE)
var mousepos := to_local(get_global_mouse_position())
draw_line(mousepos, Vector2.ZERO, Color.BLUE)
Now run the scene. You should see the collider in yellow, indicating a succesful raycast intersection with it.
Stop running the scene and change the Area2D scale x to -1
Run the scene again. You should now see the collider in white, indicating a raycast intersection could not be found, even though the drawn raycast line is clearly intersecting the collider.
Expected behavior
The raycast to return a correctly detected intersection
Versions:
OS: Windows 11 Business
Godot 4.2.1
Box2d 0.9.9
The text was updated successfully, but these errors were encountered:
Describe the bug
A simple raycast does not wield a result when the Area2D is mirrored (meaning scale.x = -1)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The raycast to return a correctly detected intersection
Versions:
The text was updated successfully, but these errors were encountered: