blob: c876831e687c2547fdebf7226ac3eb1c19c1d3a3 (
plain) (
tree)
|
|
class_name Wave
extends Resource
export var steepness = 1.0 setget set_steepness
export var wavelength = 1.0 setget set_wavelength
export var direction = Vector2(1.0,0.0) setget set_direction
var _k = 1.0 setget _set_k
var _a = 1.0 setget _set_a
var _c = 1.0 setget _set_c
var _time = 0.0 setget _set_time
var _t = 1.0 setget _set_t
func _init(s, w, d, t):
self.steepness = s
self.wavelength = w
self.direction = d
self._time = t
func set_steepness(val):
steepness = val
self._a = steepness / _k
func set_wavelength(val):
wavelength = val
self._k = TAU / wavelength
func set_direction(val):
direction = val
func _set_k(val):
_k = val
self._a = steepness / _k
self._c = sqrt(9.8 / _k)
func _set_a(val):
_a = val
func _set_c(val):
_c = val
self._t = _c * _time
func _set_time(val):
_time = val
self._t = _c * _time
func _set_t(val):
_t = val
|