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
Suggestion: Remove the mandatory target argument in the THREE.Ray: .at() and similar APIs #13655
Comments
That is true, but it can also lead to unnecessary garbage collection. It is your responsibility to instantiate objects at the application level. You can create one
Those are closures. Only one instance of the |
I think the API is fine as it is. |
|
Please reopen this issue so at least to keep the conversation open. Also, there is no harm to leave it open. @WestLangley @Mugen87 |
@wesleyted00 Sorry, this issue was discussed extensively in #12231, and a decision has been made. |
But my concerns in my last post were not discussed much in that thread.
Thank you. |
Correct because you will find your answers in #12231. With all due respect, I think there is no need to start a new discussion about that topic. |
You can write it like this: myRay.at( 0, resultVec ); |
Thank you for your comments. @WestLangley I guess the complete code should be like this: It looks not natural to me. Do you think it is really a good idea to let function argument(s) to receive the return value(s)? |
It is a trade-off. You can now do this: var resultVec = new THREE.Vector3(); // create once and reuse it
myRay.at( 0, resultVec ); |
Description of the problem
The optional target in the API like THREE.Ray: .at() has become mandatory since r91. It seems the change was discussed in #12231.
However, I suggest that the target argument can be removed. The reasons are:
ray.at(0.3)
will return a vector object, which is very natural and intuitive.Object3D.js::translateX/rotateZ
and on.Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: