Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sceneview/src/main/java/io/github/sceneview/utils/Camera.kt
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ fun Camera.worldToView(worldPosition: Position): Float2 =
* x = (0 = left, 0.5 = center, 1 = right)
* y = (0 = bottom, 0.5 = center, 1 = top)
*
* @return A Ray from the camera near to far / infinity
* @return A Ray from the camera near to far
*/
fun Camera.viewToRay(viewPosition: Float2): Ray {
val startPosition = viewToWorld(viewPosition, z = 0.0f)
val endPosition = viewToWorld(viewPosition, z = 1.0f)
val endPosition = viewToWorld(viewPosition, z = 0.99f)
val direction = endPosition - startPosition
return Ray(origin = startPosition, direction = direction)
}