propper map based platform movement

This commit is contained in:
2025-03-08 23:53:17 +01:00
parent 6bbc718eba
commit da7bbaa64a
2 changed files with 21 additions and 14 deletions

View File

@@ -688,7 +688,7 @@
// entity 7 // entity 7
{ {
"classname" "platform_target" "classname" "platform_target"
"origin" "1784 5256 776" "origin" "1672 5249 776"
"targetname" "secret_platform" "targetname" "secret_platform"
} }
// entity 8 // entity 8
@@ -860,4 +860,13 @@
( 1792 5376 128 ) ( 1793 5376 128 ) ( 1792 5376 129 ) blue-metal [ -1 0 0 32 ] [ 0 0 -1 -32 ] 90 1 1 ( 1792 5376 128 ) ( 1793 5376 128 ) ( 1792 5376 129 ) blue-metal [ -1 0 0 32 ] [ 0 0 -1 -32 ] 90 1 1
( 1792 5312 128 ) ( 1792 5312 129 ) ( 1792 5313 128 ) blue-metal [ 0 1 0 -32 ] [ 0 0 -1 -32 ] 180 1 1 ( 1792 5312 128 ) ( 1792 5312 129 ) ( 1792 5313 128 ) blue-metal [ 0 1 0 -32 ] [ 0 0 -1 -32 ] 180 1 1
} }
// brush 1
{
( 1648 5232 128 ) ( 1648 5233 128 ) ( 1648 5232 129 ) origin [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 1648 5232 128 ) ( 1648 5232 129 ) ( 1649 5232 128 ) origin [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 1648 5232 128 ) ( 1649 5232 128 ) ( 1648 5233 128 ) origin [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( 1680 5264 144 ) ( 1680 5265 144 ) ( 1681 5264 144 ) origin [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( 1680 5264 144 ) ( 1681 5264 144 ) ( 1680 5264 145 ) origin [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 1680 5264 144 ) ( 1680 5264 145 ) ( 1680 5265 144 ) origin [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
} }

View File

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