Skip to content

Instantly share code, notes, and snippets.

@milespossing
Created November 10, 2021 05:25
Show Gist options
  • Save milespossing/872554af90f47dc9ee6adbb146ccc00e to your computer and use it in GitHub Desktop.
Save milespossing/872554af90f47dc9ee6adbb146ccc00e to your computer and use it in GitHub Desktop.
Simple position system for ray tracing
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