From 1818a0b48b33a14170cdc867f64c82d8df52c265 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sat, 16 Mar 2024 18:50:22 -0400 Subject: [PATCH] position the camera in a good position in the scene --- examples/testbed/src/main.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/testbed/src/main.rs b/examples/testbed/src/main.rs index dba017e..0f9d152 100644 --- a/examples/testbed/src/main.rs +++ b/examples/testbed/src/main.rs @@ -1,6 +1,6 @@ -use std::ptr::NonNull; +use std::{cell::Ref, ptr::NonNull}; -use lyra_engine::{assets::gltf::Gltf, ecs::{system::{BatchedSystem, Criteria, CriteriaSchedule, IntoSystem}, Component, World}, game::Game, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Transform, Vec3}, render::light::{directional::DirectionalLight, SpotLight}, scene::CameraComponent, DeltaTime}; +use lyra_engine::{assets::gltf::Gltf, ecs::{query::{QueryBorrow, ViewState}, system::{BatchedSystem, Criteria, CriteriaSchedule, IntoSystem}, Component, World}, game::Game, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Quat, Transform, Vec3}, render::light::{directional::DirectionalLight, SpotLight}, scene::CameraComponent, DeltaTime}; use lyra_engine::assets::ResourceManager; mod free_fly_camera; @@ -218,7 +218,13 @@ async fn main() { } */ let mut camera = CameraComponent::new_3d(); - camera.transform.translation += math::Vec3::new(0.0, 0.0, 5.5); + // these values were taken by manually positioning the camera in the scene. + camera.transform = Transform::new( + Vec3::new(-10.0, 0.94, -0.28), + Quat::from_xyzw(0.03375484, -0.7116095, 0.0342693, 0.70092666), + Vec3::ONE + ); + //camera.transform.translation += math::Vec3::new(0.0, 0.0, 5.5); world.spawn(( camera, FreeFlyCamera::default() )); Ok(()) @@ -257,11 +263,15 @@ async fn main() { }; let jiggle_plugin = move |game: &mut Game| { - game.world_mut().add_resource(TpsAccumulator(0.0)); + /* game.world_mut().add_resource(TpsAccumulator(0.0)); let mut sys = BatchedSystem::new(); sys.with_criteria(FixedTimestep::new(45)); - sys.with_system(spin_system.into_system()); + sys.with_system(spin_system.into_system()); */ + + /* let mut camera = CameraComponent::new_3d(); + camera.transform.translation += math::Vec3::new(0.0, 0.0, 5.5); + world.spawn(( camera, FreeFlyCamera::default() )); */ //sys.with_system(fps_system); //game.with_system("fixed", sys, &[]);