Swayer.gd 334 B

123456789101112131415
  1. extends Glowy
  2. class_name Swayer
  3. export var sway_freq = 0.3
  4. export var sway_amplitude = 0.2
  5. var xx = Vector3(1,0,0)
  6. var zz = Vector3(0,0,1)
  7. var sway_phase = 0
  8. func _process(delta):
  9. var sway = sin(sway_phase)*sway_amplitude
  10. sway_phase=wrapf(sway_phase+delta*6.28*sway_freq,0,6.28)
  11. transform.basis = Basis(xx,Vector3(sway,1,0),zz)