Open QbieShay opened 1 year ago
You already have the floor method for vectors on the vectors
Oh. Thanks for pointing it out. I didn't think of that.
I think the proposal still stands though.
No problem! But I absolutely agree that Vector2/3(x) should be added, it's very helpful and reduces risk of errors
I'd even suggest Vector3(Vector2, float) and Vector3(float, Vector2)
Also see: #3884 (which is similar but has a more restricted scope)
Looks like godotengine/godot/pull/59970 is working on Vector4.
I'd second the request for swizzling, not just as a getter, but also as a setter - the example I often want is something like velocity.xz = input.xy
I very much support this proposal Main issue for me is the lack of constructors that take single ints/floats as well as "previous" kind of vector
Right now I have to do
var axis_val = 1.5
var vector = Vector3(axis_val , axis_val , axis_val)
Event though var vector = Vector3.ONE * axis_val
is an option, it both looks ugly and performs an operation on a vector instead of just initializing it.
I think it will be beneficial to have convenience constructors or factory methods to create Vector2/3
from a single float
/int
and Vector3/4
from Vector2/3
(setting the last member to zero).
So it could take a form of
var axis_val = 1.5
var vector2 = Vector2(axis_val) # same as Vector2(axis_val, axis_val)
var vector3 = Vector3(vector2) # same as Vector3(vector2.x, vector2.y, 0.0)
Or
var axis_val = 1.5
var vector2 = Vector2.from_float(axis_val) # same as Vector2(axis_val, axis_val)
var vector3 = Vector3.from_vector2(vector2) # same as Vector3(vector2.x, vector2.y, 0.0)
Depending on the philosophy of why it wasn't already there (Unity doesn't seem to have one, but Unreal does). I certainly would prefer a proper constructor if engine supports that.
Of course it would be great if it also performed implicit casts as proposed in https://github.com/godotengine/godot-proposals/issues/5545
I support it with my full heart! It would be so much easier to work with This one should not be that hard to make, is there some ideological issue?
This one should not be that hard to make, is there some ideological issue?
The main difficulty is implementing this without defining a ton of additional constructors, particularly in Vector4 and Vector4i which have four components (and therefore a lot of potential combinations). See https://github.com/godotengine/godot/pull/93012 where this has shown to be an issue.
Describe the project you are working on
Various VFX
Describe the problem or limitation you are having in your project
I work a lot with text shaders and sometimes with GDScript tool. It makes me significantly slower to have to switch paradigm for interacting with math types when coding for gdscript.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Support additional initializers and more override for math functions so that one can use vector types in GDScript like they'd do in GLSL.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
In order of importance, for me:
Below a comparison of supporting 2 vs not supporting it.![Screenshot from 2022-07-06 11-56-52](https://user-images.githubusercontent.com/7917475/177524497-102e5f19-349c-4367-86c1-04577992bd0b.png)
If this enhancement will not be used often, can it be worked around with a few lines of script?
It's a modification to GDScript
Is there a reason why this should be core and not an add-on in the asset library?
It's a modification to GDScript