gdnative icon indicating copy to clipboard operation
gdnative copied to clipboard

Implement missing Basis and Transform methods

Open ghost opened this issue 5 years ago • 8 comments

The interfaces of Basis and Transform aren't on par with GDScript's yet. A list of methods available in GDScript on those types can be found at their respective doc pages:

  • ~~Basis: http://docs.godotengine.org/en/stable/classes/class_basis.html~~
  • Transform: http://docs.godotengine.org/en/stable/classes/class_transform.html

Additionally, methods available to the engine but not exposed to GDScript can be implemented if desirable:

  • ~~Basis: https://github.com/godotengine/godot/blob/master/core/math/basis.h~~
  • Transform: https://github.com/godotengine/godot/blob/master/core/math/transform.h

If any of the methods need to be manually implemented, sanity tests should be added to make sure their output match Godot's.

ghost avatar Feb 07 '20 08:02 ghost

Basis methods added in #373.

ghost avatar May 29 '20 16:05 ghost

shouldn't this be closed?

denismaxim0v avatar Feb 05 '21 08:02 denismaxim0v

Transform still has little mathematical methods ported.

ghost avatar Feb 05 '21 09:02 ghost

Note that GDScript's Transform members have some ugly semantic inconsistencies, see https://github.com/godotengine/godot-proposals/issues/1336. Perhaps it even would make sense to anticipate that change.

bluenote10 avatar Feb 05 '21 10:02 bluenote10

Note that GDScript's Transform members have some ugly semantic inconsistencies, see godotengine/godot-proposals#1336. Perhaps it even would make sense to anticipate that change.

The point of implementing them is to make porting easier, so for this issue we care more about what the methods are, not what they should be.

ghost avatar Feb 05 '21 10:02 ghost

Actually the missing methods were implemented for Transform2D; Transform still needs doing.

Bromeon avatar Oct 30 '21 08:10 Bromeon

I'm taking a stab at this (Hi all). The Godot implementation seems to be inconsistent - some of the in-place methods call copy methods and then assign the result to self. Do you want to reproduce the same behavior in godot-rust, or can I have some freedom to fix those as I implement them?

Hexorg avatar Jun 13 '22 20:06 Hexorg

@Hexorg Thank you! I would only provide immutable methods for now (i.e. those returning a new object, not those modifying the existing one).

Feel free to improve on the Godot implementation where needed!

Would be great to add some tests with hardcoded values (ideally obtained by GDScript), like we did for Quat or Basis.

Bromeon avatar Jun 13 '22 21:06 Bromeon