Created
November 10, 2021 05:25
-
-
Save milespossing/872554af90f47dc9ee6adbb146ccc00e to your computer and use it in GitHub Desktop.
Simple position system for ray tracing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use amethyst::{ | |
ecs::{System, WriteStorage, Read, Join}, | |
core::timing::Time, | |
}; | |
use crate::rays::Ray; | |
pub struct PositionSystem; | |
impl<'a> System<'a> for PositionSystem { | |
type SystemData = WriteStorage<'a, Ray>; | |
fn run(&mut self, mut rays: Self::SystemData) { | |
for ray in (&mut rays).join(){ | |
ray.pos = ray.pos + ray.vel; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment