propper map based platform movement
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::tb_entities::Platform;
|
||||
use crate::tb_entities::{Platform, PlatformTarget};
|
||||
use bevy::{math::ops::sin, prelude::*};
|
||||
use bevy_trenchbroom::class::Target;
|
||||
|
||||
@@ -20,24 +20,22 @@ fn init(
|
||||
(Entity, &Target, &Transform),
|
||||
(Without<ActivePlatform>, With<Platform>),
|
||||
>,
|
||||
// targets: Query<(&PlatformTarget, &Transform)>,
|
||||
targets: Query<(&PlatformTarget, &Transform)>,
|
||||
) {
|
||||
for (e, _target, transform) in uninit_platforms.iter() {
|
||||
// let Some(target) = targets
|
||||
// .iter()
|
||||
// .find(|(t, _)| t.targetname == target.target.clone().unwrap_or_default())
|
||||
// .map(|(_, t)| *t)
|
||||
// else {
|
||||
// continue;
|
||||
// };
|
||||
for (e, target, transform) in uninit_platforms.iter() {
|
||||
let Some(target) = targets
|
||||
.iter()
|
||||
.find(|(t, _)| t.targetname == target.target.clone().unwrap_or_default())
|
||||
.map(|(_, t)| t.translation)
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let platform = ActivePlatform {
|
||||
start: transform.translation,
|
||||
target: transform.translation + Vec3::new(0., 20., 0.),
|
||||
target,
|
||||
};
|
||||
|
||||
info!("platform: {:?}", platform);
|
||||
|
||||
commands.entity(e).insert(platform);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user