Loading...
Searching...
No Matches
CityBuilderCore.CameraMouseInput Class Reference

Detailed Description

provides access to the position of the players pointer position using the IMouseInput interface
usually this is done by the CameraController, this behaviour can be used instead when the camera is static

https://citybuilder.softleitner.com/manual

Inheritance diagram for CityBuilderCore.CameraMouseInput:
CityBuilderCore.IMouseInput

Public Member Functions

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
 

Public Attributes

Collider MouseCollider
 
Vector2 TouchOffset = Vector3.zero
 

Protected Member Functions

virtual void Awake ()
 
virtual void Start ()
 

Member Function Documentation

◆ GetMouseGridPosition()

Vector2Int CityBuilderCore.CameraMouseInput.GetMouseGridPosition ( bool applyOffset = false)

calculates the point on the map that the pointer is currently over

Parameters
applyOffsetwhether the touch offset should be applied
Returns
a grid point on the map

Implements CityBuilderCore.IMouseInput.

◆ GetMousePosition()

Vector3 CityBuilderCore.CameraMouseInput.GetMousePosition ( bool applyOffset = false)
inline

calculates absolute world position on the map that the pointer is currently over

Parameters
applyOffsetwhether the touch offset should be applied
Returns
a position on the map

Implements CityBuilderCore.IMouseInput.

◆ GetMouseScreenPosition()

Vector2 CityBuilderCore.CameraMouseInput.GetMouseScreenPosition ( bool applyOffset = false)
inline

calculates the current position of the players pointer in screen coordinates

Parameters
applyOffsetwhether the touch offset should be applied
Returns
screen space position of the pointer

Implements CityBuilderCore.IMouseInput.

◆ GetRay()

Ray CityBuilderCore.CameraMouseInput.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
applyOffsetwhether the touch offset should be applied
Returns
a ray coming from the pointer

Implements CityBuilderCore.IMouseInput.