position the camera in a good position in the scene

This commit is contained in:
SeanOMik 2024-03-16 18:50:22 -04:00
parent cfd5cabfbb
commit 1818a0b48b
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
1 changed files with 15 additions and 5 deletions

View File

@ -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, &[]);