@@ -21,6 +21,9 @@ public class LargeWorld : MonoBehaviour
21
21
private Vector2 m_CameraPosition ;
22
22
private PhysicsWheelJoint m_RearWheelJoint ;
23
23
private PhysicsWheelJoint m_FrontWheelJoint ;
24
+
25
+ private FloatField m_WorldPosition ;
26
+ private FloatField m_WorldSize ;
24
27
25
28
private void OnEnable ( )
26
29
{
@@ -29,8 +32,8 @@ private void OnEnable()
29
32
m_UIDocument = GetComponent < UIDocument > ( ) ;
30
33
31
34
m_CameraManipulator = FindFirstObjectByType < CameraManipulator > ( ) ;
32
- m_CameraManipulator . CameraSize = 25f ;
33
- m_CameraManipulator . CameraPosition = Vector2 . zero ;
35
+ m_CameraManipulator . CameraSize = 20f ;
36
+ m_CameraManipulator . CameraPosition = new Vector2 ( 0f , - 5f ) ;
34
37
35
38
// Set up the scene reset action.
36
39
m_SandboxManager . SceneResetAction = SetupScene ;
@@ -43,7 +46,7 @@ private void OnEnable()
43
46
m_CycleCount = 600 ;
44
47
m_GridSize = 1f ;
45
48
m_GridCount = ( int ) ( m_CycleCount * m_WavePeriod / m_GridSize ) ;
46
- m_CameraPanSpeed = 0f ;
49
+ m_CameraPanSpeed = 25f ;
47
50
48
51
m_FollowCar = true ;
49
52
@@ -79,6 +82,13 @@ private void SetupOptions()
79
82
cameraPanSpeed . value = m_CameraPanSpeed ;
80
83
cameraPanSpeed . RegisterValueChangedCallback ( evt => { m_CameraPanSpeed = evt . newValue ; } ) ;
81
84
85
+ // World Position.
86
+ m_WorldPosition = root . Q < FloatField > ( "world-position" ) ;
87
+
88
+ // World Size.
89
+ m_WorldSize = root . Q < FloatField > ( "world-size" ) ;
90
+ m_WorldSize . value = m_GridSize * m_GridCount / 1000.0f ;
91
+
82
92
// Reset Scene.
83
93
var resetScene = root . Q < Button > ( "reset-scene" ) ;
84
94
resetScene . clicked += SetupScene ;
@@ -263,6 +273,9 @@ private void Update()
263
273
264
274
if ( m_FollowCar )
265
275
m_CameraManipulator . CameraPosition = new Vector2 ( m_FrontWheelJoint . bodyA . position . x , m_CameraManipulator . CameraPosition . y ) ;
276
+
277
+ // Show world position.
278
+ m_WorldPosition . value = m_CameraManipulator . CameraPosition . x / 1000.0f ;
266
279
}
267
280
268
281
private void SetCarSpeed ( float speed )
0 commit comments