Controls the camera orientation and render modes according to ViewMode in viewModeList user input. viewModeList is maintained by the state manager class in control i.e. Simulation, LogLoader, RobotEditor, EnvironmentEditor
More...
|
void | OnTestStart () |
| Raises the test start event. (handles camera exhibitionMode behaviour) More...
|
|
void | OnTestEnd () |
| Raises the test end event. (handles camera exhibitionMode behaviour) More...
|
|
Controls the camera orientation and render modes according to ViewMode in viewModeList user input. viewModeList is maintained by the state manager class in control i.e. Simulation, LogLoader, RobotEditor, EnvironmentEditor
Definition at line 12 of file CamController.cs.
Enumerator |
---|
Hybrid |
Display BotData and scene geometry.
|
Normal |
Display scene geometry only.
|
BotData |
Display the robot data (drawn with Draw class) only.
|
Definition at line 44 of file CamController.cs.
Display scene geometry only.
Display BotData and scene geometry.
Display the robot data (drawn with Draw class) only.
Enumerator |
---|
Birdseye |
Top-down orthographic view.
|
Orbit |
Camera orbit around a point of interest.
|
Mounted |
Camera attached to an object i.e. robot.
|
Static |
A stationary camera position
|
FreeMovement |
Free-flying camera.
|
Definition at line 17 of file CamController.cs.
Camera orbit around a point of interest.
Camera attached to an object i.e. robot.
A stationary camera position
Top-down orthographic view.
static CamController.CamController |
( |
| ) |
|
|
staticprivate |
Definition at line 151 of file CamController.cs.
153 _modes =
new List<ViewMode>();
155 _areas =
new List<IObservable>();
156 _stub =
new StubObservable();
static List< IObservable > _areas
static List< ViewMode > _modes
static void CamController.AddAreaOfInterest |
( |
IObservable |
area | ) |
|
|
static |
Adds an area of interest to the list of areas for the camera to observe.
- Parameters
-
area | An area of interest defined by a bounding box. |
Definition at line 163 of file CamController.cs.
static List< IObservable > _areas
static void CamController.AddViewMode |
( |
ViewMode |
mode | ) |
|
|
static |
void CamController.Awake |
( |
| ) |
|
|
private |
Definition at line 397 of file CamController.cs.
404 _camera = GetComponent<Camera>();
static CamController Instance
Gets the MonoBehaviour instance.
void CamController.BirdseyeUpdate |
( |
| ) |
|
|
private |
Place the camera above the area of interest
Definition at line 481 of file CamController.cs.
485 size = Mathf.Max(size, 0.5f);
486 _camera.orthographicSize = Mathf.Lerp(
_camera.orthographicSize, size, Time.unscaledDeltaTime * 4f);
487 Vector3 targetPosition =
area.
bounds.center + Vector3.up * 10f;
490 _camera.transform.position = Vector3.Slerp(
493 Time.unscaledDeltaTime * 4f
497 Quaternion targetRotation = Quaternion.LookRotation(Vector3.down);
498 _camera.transform.rotation = Quaternion.Slerp(
501 Time.unscaledDeltaTime * 8f
static IObservable area
Gets the current observable area of interest.
Bounds bounds
Gets the bounds of the observable object (size and location)
static void CamController.ClearAreaList |
( |
| ) |
|
|
static |
Clears the area list.
Definition at line 179 of file CamController.cs.
static List< IObservable > _areas
static void CamController.ClearViewModeList |
( |
| ) |
|
|
static |
Clears the view mode list.
Definition at line 252 of file CamController.cs.
static List< ViewMode > _modes
static void SetViewMode(ViewMode mode)
Sets the view mode.
static void CamController.CycleAreaOfInterest |
( |
| ) |
|
|
static |
Set area to next area of interest (circular index of areas list)
Definition at line 209 of file CamController.cs.
static List< IObservable > _areas
static void CamController.CycleRenderMode |
( |
| ) |
|
|
static |
Set renderMode to next RenderMode (circular index of render modes).
Definition at line 216 of file CamController.cs.
static RenderMode renderMode
Gets or sets the RenderMode in use. RenderMode determines which render layers are drawn...
static void CamController.CycleViewMode |
( |
| ) |
|
|
static |
Set viewMode to the next ViewMode in viewModeList (circular index of viewModeList).
Definition at line 315 of file CamController.cs.
static List< ViewMode > _modes
static void SetViewMode(ViewMode mode)
Sets the view mode.
void CamController.FreeMovementUpdate |
( |
| ) |
|
|
private |
Camera position and rotation controlled by axis keys and mouse axis
Definition at line 508 of file CamController.cs.
514 float y = Input.GetAxisRaw(
"Z") *
freeMoveSpeed * b * Time.unscaledDeltaTime;
515 float x = Input.GetAxisRaw(
"X") *
freeMoveSpeed * b * Time.unscaledDeltaTime;
517 Vector3 pos = transform.position;
518 pos += transform.forward * y;
519 pos += transform.right * x;
520 transform.position = pos;
float freeMoveSpeed
Camera translation speed when in free movement mode
float freeMoveSpeedShiftMult
Camera translation speed multiplier when the SHIFT key is used
void CamController.OnTestEnd |
( |
| ) |
|
Raises the test end event. (handles camera exhibitionMode behaviour)
Definition at line 390 of file CamController.cs.
static bool exhibitionMode
Exhibition mode will run continually and randomly choose camera perspectives and simulation settings...
static void SetViewMode(ViewMode mode)
Sets the view mode.
static ReadOnlyCollection< ViewMode > viewModeList
List of all ViewMode in effect.
This is a manager class used to overlook the running of a simulation.
void CamController.OnTestStart |
( |
| ) |
|
Raises the test start event. (handles camera exhibitionMode behaviour)
Definition at line 379 of file CamController.cs.
static void CycleAreaOfInterest()
Set area to next area of interest (circular index of areas list)
static bool exhibitionMode
Exhibition mode will run continually and randomly choose camera perspectives and simulation settings...
static void RandomViewMode()
Set viewMode to random ViewMode in viewModeList.
This is a manager class used to overlook the running of a simulation.
static void RandomRenderMode()
Set renderMode to random RenderMode.
void CamController.OrbitUpdate |
( |
| ) |
|
|
private |
Camera orbit around the area of interest center
Definition at line 526 of file CamController.cs.
543 _camera.transform.position = Vector3.Slerp(
546 Time.unscaledDeltaTime * 4f
550 Quaternion targetRotation = Quaternion.LookRotation(
area.
bounds.center - targetPosition);
551 _camera.transform.rotation = Quaternion.Slerp(
554 Time.unscaledDeltaTime * 8f
static IObservable area
Gets the current observable area of interest.
Bounds bounds
Gets the bounds of the observable object (size and location)
static void CamController.RandomRenderMode |
( |
| ) |
|
|
static |
Set renderMode to random RenderMode.
Definition at line 224 of file CamController.cs.
static RenderMode renderMode
Gets or sets the RenderMode in use. RenderMode determines which render layers are drawn...
static void CamController.RandomViewMode |
( |
| ) |
|
|
static |
Set viewMode to random ViewMode in viewModeList.
Definition at line 322 of file CamController.cs.
static List< ViewMode > _modes
static void SetViewMode(ViewMode mode)
Sets the view mode.
static void CamController.RemoveAreaOfInterest |
( |
IObservable |
area | ) |
|
|
static |
Removes an area of interest from the list of areas for the camera to observe.
- Parameters
-
area | An area of interest defined by a bounding box. |
Definition at line 171 of file CamController.cs.
static List< IObservable > _areas
static void CamController.RemoveViewMode |
( |
ViewMode |
mode | ) |
|
|
static |
Removes a ViewMode from viewModeList.
- Parameters
-
mode | The view mode enum to remove. |
Definition at line 242 of file CamController.cs.
static List< ViewMode > _modes
static void SetViewMode(ViewMode mode)
Sets the view mode.
void CamController.RenderModeUpdate |
( |
| ) |
|
|
private |
Call INavigation.DrawDebugInfo as appropriate (Camera culling mask is handled in renderMode.set)
Definition at line 472 of file CamController.cs.
static Robot robot
Gets reference to the robot in the current simulation.
static bool isRunning
Gets a value indicating whether this Simulation is running.
INavigation navigation
Interface to the navigation assembly.
This is a manager class used to overlook the running of a simulation.
static RenderMode renderMode
Gets or sets the RenderMode in use. RenderMode determines which render layers are drawn...
static void CamController.SetAreaOfInterest |
( |
int |
index | ) |
|
|
static |
Sets the area of interest by index.
- Parameters
-
index | Index for area list. |
Definition at line 188 of file CamController.cs.
190 if (index < 0 || index >=
_areas.Count) {
191 Debug.LogWarning(
"SetAreaOfInterest index param out of range. Ignoring.");
static List< IObservable > _areas
static void CamController.SetAreaOfInterest |
( |
IObservable |
obj | ) |
|
|
static |
Sets the area of interest by object (does nothing if the obj is not in the areas list.
- Parameters
-
Definition at line 201 of file CamController.cs.
202 int index =
_areas.IndexOf(obj);
203 if (index >= 0)
_area = index;
static List< IObservable > _areas
static void CamController.SetViewMode |
( |
ViewMode |
mode | ) |
|
|
static |
Sets the view mode.
- Parameters
-
mode | ViewMode selection. If selection is not in viewModeList then it will fail. |
Definition at line 262 of file CamController.cs.
263 int index =
_modes.IndexOf(mode);
static List< ViewMode > _modes
static void SetViewMode(ViewMode mode)
Sets the view mode.
static void CamController.SetViewMode |
( |
int |
index | ) |
|
|
static |
Sets the view mode.
- Parameters
-
index | Index for selecting from viewModeList. |
Definition at line 271 of file CamController.cs.
273 if (index < 0 || index >=
_modes.Count) {
274 Debug.LogWarning(
"SetViewMode index param out of range. Ignoring.");
278 _camera.transform.parent = null;
285 _camera.transform.localPosition = Vector3.zero;
286 _camera.transform.localRotation = Quaternion.identity;
297 Vector3 position = b.max;
299 position.x = Random.value < 0.5f ? b.min.x : b.max.x;
300 position.z = Random.value < 0.5f ? b.min.z : b.max.z;
301 Instance.transform.position = position;
302 Instance.transform.rotation = Quaternion.LookRotation(b.center -
Instance.transform.position);
306 _camera.camera.orthographic =
true;
307 _camera.transform.parent = null;
static Simulation Instance
Reference to the MonoBebehaviour instance
static CamController Instance
Gets the MonoBehaviour instance.
static Robot robot
Gets reference to the robot in the current simulation.
static List< ViewMode > _modes
Bounds bounds
The simulation bounds described as a cube. This is the search space indicated to INavigation.
Transform cameraMount
The first-person perspective camera position.
This is a manager class used to overlook the running of a simulation.
void CamController.Start |
( |
| ) |
|
|
private |
Definition at line 408 of file CamController.cs.
static void SetViewMode(ViewMode mode)
Sets the view mode.
void CamController.Update |
( |
| ) |
|
|
private |
Definition at line 413 of file CamController.cs.
417 camera.rect =
new Rect(0, 0, 1f-w, 1f);
420 if ( camera.pixelRect.Contains(Input.mousePosition) ) {
432 if (Input.GetMouseButton(1)) {
435 Quaternion rotation = Quaternion.AngleAxis(-y, Vector3.up);
437 rotation = Quaternion.AngleAxis(x,
_camera.transform.right);
440 rotation = Quaternion.AngleAxis(y, Vector3.up);
442 rotation = Quaternion.AngleAxis(-x,
_camera.transform.right);
static void CycleAreaOfInterest()
Set area to next area of interest (circular index of areas list)
float mouseSensitivity
Multiplies speed of mouse axis input
void FreeMovementUpdate()
Camera position and rotation controlled by axis keys and mouse axis
void OrbitUpdate()
Camera orbit around the area of interest center
static ViewMode viewMode
Gets the current ViewMode.
static void CycleRenderMode()
Set renderMode to next RenderMode (circular index of render modes).
void BirdseyeUpdate()
Place the camera above the area of interest
void RenderModeUpdate()
Call INavigation.DrawDebugInfo as appropriate (Camera culling mask is handled in renderMode.set)
static void CycleViewMode()
Set viewMode to the next ViewMode in viewModeList (circular index of viewModeList).
Vector3 CamController._1stPersonDir = Vector3.one |
|
private |
Vector3 CamController._3rdPersonDir = Vector3.one |
|
private |
float CamController._3rdPersonDist = 0.5f |
|
private |
float CamController._birdseyeDist = 0f |
|
private |
Camera CamController._camera |
|
staticprivate |
float CamController.freeMoveSpeed |
Camera translation speed when in free movement mode
Definition at line 339 of file CamController.cs.
float CamController.freeMoveSpeedShiftMult |
Camera translation speed multiplier when the SHIFT key is used
Definition at line 344 of file CamController.cs.
LayerMask CamController.maskBotData |
LayerMask CamController.maskCameraCollision |
Camera collision mask to avoid placing camera inside objects.
Definition at line 350 of file CamController.cs.
LayerMask CamController.maskHybrid |
LayerMask CamController.maskNormal |
float CamController.mouseSensitivity |
Gets or sets the RenderMode in use. RenderMode determines which render layers are drawn.
Definition at line 99 of file CamController.cs.
ReadOnlyCollection<ViewMode> CamController.viewModeList |
|
staticget |
The documentation for this class was generated from the following file: