|
[gd_scene load_steps=5 format=3 uid="uid://ddeq7mn1ealyc"] |
|
|
|
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"] |
|
|
|
[sub_resource type="GDScript" id="2"] |
|
script/source = "extends Node2D |
|
|
|
|
|
|
|
func _physics_process(delta: float) -> void: |
|
print(\"step start\") |
|
|
|
" |
|
|
|
[sub_resource type="GDScript" id="1"] |
|
script/source = "extends RayCast2D |
|
|
|
var steps = 1 |
|
|
|
func _physics_process(delta: float) -> void: |
|
print(\"processing raycast\") |
|
steps += 1 |
|
if steps % 2: |
|
force_raycast_update() |
|
|
|
print(is_colliding()) |
|
" |
|
|
|
[sub_resource type="CircleShape2D" id="3"] |
|
|
|
[node name="ExampleRaycastSensor2D" type="Node2D"] |
|
script = SubResource("2") |
|
|
|
[node name="ExampleAgent" type="Node2D" parent="."] |
|
position = Vector2(573, 314) |
|
rotation = 0.286234 |
|
|
|
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"] |
|
script = ExtResource("1") |
|
|
|
[node name="TestRayCast2D" type="RayCast2D" parent="."] |
|
script = SubResource("1") |
|
|
|
[node name="StaticBody2D" type="StaticBody2D" parent="."] |
|
position = Vector2(1, 52) |
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] |
|
shape = SubResource("3") |
|
|