Skip to content

Commit

Permalink
impl From for Vel, Pos convert
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffA233 committed Dec 5, 2023
1 parent c6aa0e5 commit d5f5e6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/gamestates/physics_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ impl IntoIterator for Position {
}
}

impl From<Velocity> for Position {
fn from(value: Velocity) -> Self {
Self { x: value.x, y: value.y, z: value.z }
}
}

#[derive(Clone, Copy, Default, Debug)]
pub struct Velocity {
pub x: f32,
Expand Down Expand Up @@ -467,6 +473,12 @@ impl IntoIterator for Velocity {
}
}

impl From<Position> for Velocity {
fn from(value: Position) -> Self {
Velocity { x: value.x, y: value.y, z: value.z }
}
}

#[derive(Clone, Copy, Default, Debug)]
pub struct Quaternion {
pub w: f32,
Expand Down
5 changes: 4 additions & 1 deletion tests/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use std::{
}};

// use std::collections::HashMap;
use rlgym_sim_rs::action_parsers::test_parser::TestAction;
use rlgym_sim_rs::{
action_parsers::test_parser::TestAction,
// gamestates::physics_object::Position
};
use rlgym_sim_rs::conditionals::common_conditions::{TimeoutCondition, GoalScoredCondition};
use rlgym_sim_rs::conditionals::terminal_condition::TerminalCondition;
use rlgym_sim_rs::envs::game_match::GameConfig;
Expand Down

0 comments on commit d5f5e6b

Please sign in to comment.