CameraComponentExtensions.cs
These extensions provide powerful and convenient ways to interact with the camera, transforming coordinates between different spaces, performing raycasting, and handling user inputs for dynamic camera control. Whether you are implementing complex camera behaviors or simply looking to streamline common camera operations, these extensions are designed to make your development process more efficient and intuitive.
Below is a list of available extension methods:
GetPickRay()
- Calculates a ray from the camera through a point on the screen in world spaceLogicDirectionToWorldDirection()
- Converts a 2D logical direction into a 3D world direction relative to the camera's orientationLogicDirectionToWorldDirection()
- Converts a 2D logical direction into a 3D world direction relative to the camera's orientation, using a specified up vectorRaycast()
- Performs a raycasting operation from the specified CameraComponent's position through the specified screen position in world coordinates, and returns information about the hit resultRaycastMouse()
- Performs a raycasting operation from the specified CameraComponent's position through the mouse cursor position in screen coordinates, and returns information about the hit resultScreenPointToRay()
- Calculates the near and far vectors for a ray that starts at the camera and passes through a given screen pointScreenToWorldPoint()
- Converts the screen position to a point in world coordinatesScreenToWorldRaySegment()
- Converts the screen position to aRaySegment
in world coordinatesScreenToWorldRaySegment()
- Converts the screen position to aRaySegment
in world coordinatesWorldToClip()
- Converts the world position to clip space coordinates relative to cameraWorldToScreenPoint()
- Converts the world position to screen space coordinates relative to camera
Each of these methods is designed to offer streamlined, high-level operations that simplify camera manipulation tasks, allowing you to focus on creating immersive and dynamic 3D environments.