Camera3D Module
Helper functions for 3D Cameras (Perspective projection).
Use these for first-person, third-person, or any 3D game rendering.
Functions and values
| Function or value |
Description
|
|
Calculates the BoundingFrustum for the camera. The frustum represents the visible volume of the camera. Useful for 3D culling (octree queries, sphere/box visibility checks).
Example
val frustum: obj
|
Full Usage:
lookAt position target up fov aspectRatio nearPlane farPlane
Parameters:
Vector3
-
Camera position in world space
target : Vector3
-
Point the camera is looking at
up : Vector3
-
Up vector (typically Vector3.Up)
fov : float32
-
Field of view in radians (e.g., MathHelper.PiOver4)
aspectRatio : float32
-
Width / Height of the viewport
nearPlane : float32
-
Near clipping distance (objects closer are not rendered)
farPlane : float32
-
Far clipping distance (objects farther are not rendered)
Returns: Camera
|
Creates a camera that looks at a target from a position.
Example
val camera: obj
|
Full Usage:
orbit target yaw pitch radius fov aspect near far
Parameters:
Vector3
-
Point the camera orbits around
yaw : float32
-
Horizontal rotation angle in radians
pitch : float32
-
Vertical rotation angle in radians
radius : float32
-
Distance from target
fov : float32
-
Field of view in radians
aspect : float32
-
Aspect ratio
near : float32
-
Near plane
far : float32
-
Far plane
Returns: Camera
|
Creates an orbiting camera using spherical coordinates. Useful for third-person cameras, inspection views, or editor cameras.
|
|
Creates a ray from screen coordinates for mouse/touch picking. The ray originates at the camera's near plane at the screen position and points into the scene. Use Ray.Intersects to test against geometry.
Example
val ray: obj
|
Mibo