-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Fixed sprite raycast bug when sizeAttenuation is false #14936
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
Conversation
|
Thanks! What happens if the camera is orthographic? |
|
If the camera is orthographic, the I can't judge what type of camera he is. |
Right. That is what I was afraid of... |
|
Maybe we should add a note if the camera is orthographic do not set sizeAttenuation of the sprite |
|
The user could be using a custom |
|
#14888 Maybe this is a solution. |
|
A raycast can emanate from any point, in any direction -- it does not have to emanate from a camera. Consequently, raycasting against a |
|
Sprite is a 3d object that is always facing the camera(This is the main reason raycast relies on cameras). We can do this by dynamically setting the vertices in js or using shader.Just because we chose shader for performance reasons makes raycast implementation difficult, I don't think Sprite raycast is meaningless. |
Sprite is a 2D object, actually.
Raycasting does not require a camera. It is the sprite that is camera-dependent.
Raycasting against a sprite using a ray that does not emanate from a camera is pretty meaningless because there is no way to determine how big the sprite should be, or how it should be oriented. |
713ecc7 to
d352c9e
Compare
|
Fixed in #16423, so close it. |
Fixed #14934
demo
If using an orthographic camera the results is wrong.