- Edited
I got an issue where inheritance is not working.
I get this error.
res://addons/water/scripts/script_water_water_body.gd:23 - Invalid call. Nonexistent function 'run_water_shape' in base 'Node (WaterWaterShapeGerstnerWavesGeneratedMinMax)'.
I restarted the editor multiple times and even remade the files. Also toggled off the plugin and toggled it back on.
Here is parent class.
extends Node
class_name WaterWaterShape
func _ready(): pass
func _process(delta): pass
func run_water_shape(time_in:float, resolution_in:int, position_offset_in:Vector2)->void:
pass;
Here is child class.
class_name WaterWaterShapeGerstnerWavesGeneratedMinMax
extends WaterWaterShape
func _ready(): pass
func _process(delta): pass
func run_water_shape(time_in:float, resolution_in:int, position_offset_in:Vector2)->void:
resolution = resolution_in;
time = time_in;
position_offset = position_offset_in;
_init_compute_shader();
_update_compute_shader_uniforms();
_run_compute_shader();
_read_compute_shader_results();
_refresh_resources();
Here is how I am using child class.
@tool
extends Node3D
class_name WaterWaterBody
# Resolution
const RESOLUTION_MAX = 1024;
const RESOLUTION_MIN = 8;
var resolution = 1024;
var time;
func _ready():
time = 10;
func _process(delta):
# Progress time
time += delta;
# Run water shapes
for water_shape in get_water_shapes():
water_shape.run_water_shape(time, resolution,Vector2(0,0));
func get_water_shapes() -> Array:
var children = get_children();
var water_shapes_array = [];
for child in children:
if child is WaterWaterShape:
water_shapes_array.append(child);
return water_shapes_array;