linear track plugin
This commit is contained in:
parent
c1e53bdab0
commit
68c895ec14
6 changed files with 160 additions and 0 deletions
17
src/states/linear/components_track.rs
Normal file
17
src/states/linear/components_track.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Track{
|
||||
pub start_point: Vec2,
|
||||
pub start_direction: Vec2, // будет нормализовано при построении
|
||||
pub segments: Vec<PathSegment>,
|
||||
}
|
||||
|
||||
// линия всегда строится от точки старта по направлению
|
||||
// направление изменяется сегментами поворота
|
||||
// left при истине - поворот против часовой стрелки, ложь - по часовой
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum PathSegment{
|
||||
Line { length: f32 },
|
||||
Turn { radius: f32, left: bool },
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue