camera controller that works with various setups and provides mouse inpurt and main camera interfaces
https://citybuilder.softleitner.com/manual
|
Ray | GetRay (bool applyOffset=false) |
| creates a ray under the players mouse that points in the cameras direction
can be used to check whats currently under the player pointer
|
|
Vector3 | GetMousePosition (bool applyOffset=false) |
| calculates absolute world position on the map that the pointer is currently over
|
|
Vector2 | GetMouseScreenPosition (bool applyOffset=false) |
| calculates the current position of the players pointer in screen coordinates
|
|
Vector2Int | GetMouseGridPosition (bool applyOffset=false) |
| calculates the point on the map that the pointer is currently over
|
|
void | SetCulling (LayerMask layerMask) |
| sets the culling of the main camera to the passed mask
the original mask is saved so it can be restored using ResetCulling
|
|
void | ResetCulling () |
| resets the culling on the main camera to its original layer mask after is has been changed by SetCulling(LayerMask)
|
|
CoroutineToken | Jump (Vector3 position, Quaternion? rotation=null) |
| quickly moves the camera to a position on the map
for example to focus on some happening
|
|
CoroutineToken | Follow (Transform leader) |
| moves the camera to a transform and follows it
following is canceled when the user moves the camera or the transform becomes inactive
|
|
Ray | GetRay (Vector2 screenPosition) |
|
Vector3 | GetMousePosition (Vector2 screenPosition) |
|
|
Camera | Camera |
|
Transform | Pivot |
|
float | Speed = 5 |
|
float | RotateSpeed = 50 |
|
float | PitchSpeed = 50 |
|
float | ZoomSpeed = 10 |
|
float | MinZoom = 2 |
|
float | MaxZoom = 15 |
|
Vector3 | SortAxis |
|
Collider | MouseCollider |
|
Collider | ZoomCollider |
|
float | ZoomColliderDistance = 1f |
|
bool | TwoFingerPan = true |
|
float | PinchSpeed = 0.005f |
|
Vector2 | TouchOffset = Vector3.zero |
|
|
virtual void | Awake () |
|
virtual void | Start () |
|
|
Vector3 | Position [get, set] |
| position the camera point to on the map, not the position of the camera itself
|
|
Quaternion | Rotation [get, set] |
| current rotation of the main camera(used only to persist camera rotation currently), only applies in 3d
|
|
float | Size [get, set] |
| current size of the main camera(used only to persist camera size currently)
|
|
Properties inherited from CityBuilderCore.IMainCamera |
◆ Follow()
CoroutineToken CityBuilderCore.CameraController.Follow |
( |
Transform | leader | ) |
|
|
inline |
moves the camera to a transform and follows it
following is canceled when the user moves the camera or the transform becomes inactive
- Parameters
-
leader | the transform the camera should follow |
Implements CityBuilderCore.IMainCamera.
◆ GetMouseGridPosition()
Vector2Int CityBuilderCore.CameraController.GetMouseGridPosition |
( |
bool | applyOffset = false | ) |
|
calculates the point on the map that the pointer is currently over
- Parameters
-
applyOffset | whether the touch offset should be applied |
- Returns
- a grid point on the map
Implements CityBuilderCore.IMouseInput.
◆ GetMousePosition()
Vector3 CityBuilderCore.CameraController.GetMousePosition |
( |
bool | applyOffset = false | ) |
|
|
inline |
calculates absolute world position on the map that the pointer is currently over
- Parameters
-
applyOffset | whether the touch offset should be applied |
- Returns
- a position on the map
Implements CityBuilderCore.IMouseInput.
◆ GetMouseScreenPosition()
Vector2 CityBuilderCore.CameraController.GetMouseScreenPosition |
( |
bool | applyOffset = false | ) |
|
|
inline |
calculates the current position of the players pointer in screen coordinates
- Parameters
-
applyOffset | whether the touch offset should be applied |
- Returns
- screen space position of the pointer
Implements CityBuilderCore.IMouseInput.
◆ GetRay()
Ray CityBuilderCore.CameraController.GetRay |
( |
bool | applyOffset = false | ) |
|
creates a ray under the players mouse that points in the cameras direction
can be used to check whats currently under the player pointer
- Parameters
-
applyOffset | whether the touch offset should be applied |
- Returns
- a ray coming from the pointer
Implements CityBuilderCore.IMouseInput.
◆ Jump()
CoroutineToken CityBuilderCore.CameraController.Jump |
( |
Vector3 | position, |
|
|
Quaternion? | rotation = null ) |
|
inline |
quickly moves the camera to a position on the map
for example to focus on some happening
- Parameters
-
position | the absolute position on the map |
rotation | optional rotation the camera should have |
Implements CityBuilderCore.IMainCamera.
◆ ResetCulling()
void CityBuilderCore.CameraController.ResetCulling |
( |
| ) |
|
◆ SetCulling()
void CityBuilderCore.CameraController.SetCulling |
( |
LayerMask | layerMask | ) |
|
sets the culling of the main camera to the passed mask
the original mask is saved so it can be restored using ResetCulling
- Parameters
-
layerMask | the layer mask to set on the main camera |
Implements CityBuilderCore.IMainCamera.
◆ Position
Vector3 CityBuilderCore.CameraController.Position |
|
getset |
◆ Rotation
Quaternion CityBuilderCore.CameraController.Rotation |
|
getset |
current rotation of the main camera(used only to persist camera rotation currently), only applies in 3d
Implements CityBuilderCore.IMainCamera.
◆ Size
float CityBuilderCore.CameraController.Size |
|
getset |