Overriding the methods of a low-level engine class
Asked Answered
A

1

0

I want to experiment with custom implementations of Noise, but it appears there's no way to override any of its methods.

GDScript doesn't work:

extends Noise

func get_noise_2d(x: float, y: float) -> float:
	return 0.0

---


Line 3:The method "get_noise_2d()" overrides a method from native class "Noise". This won't be called by the engine and may not work as expected. (Warning treated as error.)

My understanding of the issue is that: duck-typing is expensive, and the engine simply won't let me override a function in GDScript.

I'm willing to implement it in C++ / C# if that solves the issue, but at this point I'm basically unsure what the idiomatic approach is here.

Absorbefacient answered 13/8, 2023 at 11:55 Comment(0)
K
0

Try this

@warning_ignore("native_method_override")
func get_noise_2d(x: float, y: float) -> float:

Kamila answered 22/9, 2023 at 14:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.