edbeeching / godot_rl_agents_plugin

The Godot plugin asset for the Godot RL Agents library
MIT License
121 stars 16 forks source link

Fix class_sensor type mismatch error in RaycastSensor3D.gd #33

Closed Ivan-267 closed 9 months ago

Ivan-267 commented 10 months ago

When using the class sensor option and storing the observations in a float array, an error occurs:

E 0:00:17:0513 RobotAIController.gd:37 @ get_raycast_sensor_obs(): Attempted to append_array a variable of type 'bool' into a TypedArray of type 'float'. <C++ Error> Method/function failed. Returning: false <C++ Source> core/variant/container_type_validate.h:97 @ validate()

RobotAIController.gd:37 @ get_raycast_sensor_obs() RobotAIController.gd:13 @ get_obs() sync.gd:315 @ _get_obs_from_agents() sync.gd:100 @ _physics_process()

Converting the type of the class sensor detection to float resolves this issue.