-
Notifications
You must be signed in to change notification settings - Fork 22
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
RFC: Vector library #34
base: master
Are you sure you want to change the base?
Conversation
I think the min, max functions should accept multiple vectors as the current math.max and min allow multiple numbers, plus roblox's vector3s min and max methods also accept multiple vectors. There should also be abs and clamp functions, as those would be useful for vectors. Plus id assume it would be intended to keep the vector library in feature parity somewhat with the math lib. |
docs/vector-library.md
Outdated
|
||
--- | ||
|
||
`vector(x: number?, y: number?, z: number?)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`vector(x: number?, y: number?, z: number?)` | |
`vector(x: number, y: number, z: number)` |
It's best to encourage practice of hitting the fastest constructor we have available.
It will also avoid confusion of what vector(1) is.
While Vector3.new(1)
is [1, 0, 0] on Roblox, for people coming from GLSL where vec3(1)
is [1, 1, 1], it might be unintuitive.
Even if supported by runtime, the typing can be more strictly defined.
docs/vector-library.md
Outdated
|
||
`vector.angle(vecA: vector, vecB: vector): vector` | ||
|
||
Returns the angle between two vectors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what units?
docs/vector-library.md
Outdated
|
||
Returns the cross product of two vectors. If 4-wide vectors are enabled, this function will ignore the fourth component, and return the 3-dimensional cross product. | ||
|
||
`vector.dot(vecA: vector, vecB: vector): vector` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dot product results in a number.
Would we include this in the Roblox engine? |
Rendered