FloorPath.gd 369 B

123456789101112131415161718192021
  1. tool
  2. extends Path
  3. class_name FloorPath
  4. var ignore = false
  5. func _ready():
  6. connect("curve_changed",self,"rectify")
  7. func rectify():
  8. if ignore:
  9. ignore=false
  10. return
  11. print("snapping stuff to the floor")
  12. for p in range(curve.get_point_count()):
  13. var pos = curve.get_point_position(p)
  14. pos = Vector3(pos.x,0,pos.z)
  15. ignore=true
  16. curve.set_point_position(p,pos)