File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ fn update_lights(
263
263
#[ derive( Component ) ]
264
264
struct CameraController {
265
265
pub enabled : bool ,
266
+ pub initialized : bool ,
266
267
pub sensitivity : f32 ,
267
268
pub key_forward : KeyCode ,
268
269
pub key_back : KeyCode ,
@@ -283,6 +284,7 @@ impl Default for CameraController {
283
284
fn default ( ) -> Self {
284
285
Self {
285
286
enabled : true ,
287
+ initialized : false ,
286
288
sensitivity : 0.5 ,
287
289
key_forward : KeyCode :: W ,
288
290
key_back : KeyCode :: S ,
@@ -316,6 +318,12 @@ fn camera_controller(
316
318
}
317
319
318
320
for ( mut transform, mut options) in query. iter_mut ( ) {
321
+ if !options. initialized {
322
+ let ( _roll, yaw, pitch) = transform. rotation . to_euler ( EulerRot :: ZYX ) ;
323
+ options. yaw = yaw;
324
+ options. pitch = pitch;
325
+ options. initialized = true ;
326
+ }
319
327
if !options. enabled {
320
328
continue ;
321
329
}
You can’t perform that action at this time.
0 commit comments