-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Allow constructing Quat from two Vector3s #90464
base: 3.x
Are you sure you want to change the base?
Conversation
Could this be a method of It seems slightly counter-intuitive (and difficult for discoverability) to try and put this as a method of @AThousandShips : Note this is for 3.x, as 4.x has it exposed already it sounds like, but 3.x can not use the same method. |
Yep, realized after, you caught it before I got to it |
Could be. The downside is that you have to create an empty Quat first, as there is no static method. Do you think it's acceptable? var q1 := v1.quat_to(v2)
var q2 := Quat()
q2.make_rotation(v1, v2) |
Hmm, certainly worth getting a few more opinions on before merging (I'm open to either, but would be nice to be sure before committing to an API). In fact I'd prefer to leave this for @akien-mga to look at before we commit to it. I'll admit the former looks more efficient (in e.g. bound languages with no optimization), but on the other hand it seems to make more logical sense to keep |
I think moving it to The way the method is now defined in the middle of |
Changed to Just noticed that |
The name Would |
I think shortest arc is probably the best term. There is also "great circle arc" and "minor arc" but shortest arc seems to convey what we are after. Double checking with any mathematicians, @kleonc does this naming sound okay? |
Sounds fine to me, but got to clarify it n-th time: I'm not a mathematician. 😄 I do get why I could be considered a math-guy though, and I'm absolutely fine with it! Still had to clarify. 🙂 Besides the naming I want you to be aware of #80249, see my comment: #80249 (comment) (seems still relevant). To be sure I'll link this / ask for some potential feedback on Godot Discord's math channel (there are some more-mathy-than-me folks in there). |
Yes the input could be verified (at the least in I wonder whether we should return a bool for success or failure to cover this, or an error code. There is an opportunity to make a more sensible function than is present in 4.x. e.g.
What do you guys think? |
Closes godotengine/godot-proposals#424
This quaternion constructor is exposed in 4.x.
But GDScript in 3.x doesn't allow having multiple constructors with the same argument count but different types. Nor are static methods available. Therefore, I added thequat_to()
method toVector3
, similar toangle_to()
.Adds
set_rotation(from, to)
toQuat
.