Camera3D Module
Helper functions for 3D Cameras (Perspective / Orthographic projection).
Use these for first-person, third-person, or any 3D game rendering.
Functions and values
| Function or value |
Description
|
|
|
|
Creates a perspective camera that looks at a target from a position.
Defaults: up =
Example
val camera: obj
|
Full Usage:
orbit target yaw pitch radius fovY
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.
fovY : float32
-
Vertical field of view in radians.
Returns: Camera3D
Modifiers: inline |
Creates an orbiting perspective camera using spherical coordinates.
Useful for third-person cameras, inspection views, or editor cameras.
Defaults: up =
|
|
Create a rendering config from a MonoGame 3D camera. Defaults: fullscreen, no clear.
|
Full Usage:
screenPointToRay camera screenPos viewportWidth viewportHeight
Parameters:
Camera3D
-
The camera to compute the ray for.
screenPos : Vector2
-
The screen position in pixels.
viewportWidth : float32
-
Viewport width in pixels.
viewportHeight : float32
-
Viewport height in pixels.
Returns: Ray
|
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.
|
Full Usage:
splitScreenBottom camera clearColor bounds
Parameters:
Camera3D
clearColor : Color
bounds : Rectangle
-
Parent viewport bounds in pixels (typically the window size).
Returns: Camera3DConfig
Modifiers: inline |
Split-screen bottom half. Clears with given color.
|
Full Usage:
splitScreenLeft camera clearColor bounds
Parameters:
Camera3D
clearColor : Color
bounds : Rectangle
-
Parent viewport bounds in pixels (typically the window size).
Returns: Camera3DConfig
Modifiers: inline |
Split-screen left half. Clears with given color.
|
Full Usage:
splitScreenRight camera clearColor bounds
Parameters:
Camera3D
clearColor : Color
bounds : Rectangle
-
Parent viewport bounds in pixels (typically the window size).
Returns: Camera3DConfig
Modifiers: inline |
Split-screen right half. Clears with given color.
|
Full Usage:
splitScreenTop camera clearColor bounds
Parameters:
Camera3D
clearColor : Color
bounds : Rectangle
-
Parent viewport bounds in pixels (typically the window size).
Returns: Camera3DConfig
Modifiers: inline |
Split-screen top half. Clears with given color.
|
Full Usage:
withClear color config
Parameters:
Color
config : Camera3DConfig
Returns: Camera3DConfig
Modifiers: inline |
Clear with this color before rendering.
|
|
|
|
|
Full Usage:
withViewport viewport config
Parameters:
Rectangle
config : Camera3DConfig
Returns: Camera3DConfig
Modifiers: inline |
Set viewport in pixel coordinates.
|
Mibo