Transform25D.gd 594 B

12345678910111213141516171819202122
  1. # Currently broken unless Godot makes this kind of thing possible:
  2. # https://github.com/godotengine/godot/issues/21461
  3. # https://github.com/godotengine/godot-proposals/issues/279
  4. # Calculates the 2D transformation from a 3D position and a Basis25D.
  5. class_name Transform25D
  6. var spatial_position: Vector3 = Vector3()
  7. var basis #: Basis25D
  8. func flat_transform():
  9. return Transform2D(0, flat_position())
  10. func flat_position():
  11. var pos = spatial_position.x * basis.x
  12. pos += spatial_position.y * basis.y
  13. pos += spatial_position.z * basis.z
  14. return pos
  15. func _init(basis25d):
  16. basis = basis25d