[−][src]Trait myelin_engine::simulation::Simulation  
A Simulation that can be filled with Object on
which it will apply physical rules when calling step.
This trait represents our API.
This trait is sealed and cannot be implemented by downstream crates.
Required methods
fn step(&mut self)
Advance the simulation by one tick. This will apply forces to the objects, handle collisions and allow them to take action.
fn add_object(
    &mut self, 
    object_description: ObjectDescription<T>, 
    object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>
&mut self,
object_description: ObjectDescription<T>,
object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>
Add a new object to the world.
fn objects(&self) -> Snapshot<T>
Returns a read-only description of all objects currently inhabiting the simulation.
fn object(&self, id: Id) -> Option<Object<T>>
Returns a read-only description an object, if the provided ID is valid.
fn set_simulated_timestep(&mut self, timestep: f64)
Sets how much time in seconds is simulated for each step.
Examples
If you want to run a simulation with 60 steps per second, you
can run set_simulated_timestep(1.0/60.0). Note that this method
does not block the thread if called faster than expected.
fn objects_in_area(&self, area: Aabb) -> Snapshot<T>
Returns read-only descriptions for all objects either completely contained or intersecting with the given area.
fn objects_in_polygon(&self, area: &Polygon) -> Snapshot<T>
Returns read-only descriptions for all objects either completely contained or intersecting with the given area.
fn objects_in_ray(&self, origin: Point, direction: Vector) -> Snapshot<T>
Returns read-only descriptions for all objects intersecting with the given vector.
Implementors
impl<T> Simulation<T> for SimulationImpl<T> where
    T: AssociatedObjectData, [src]
T: AssociatedObjectData,
fn step(&mut self)[src]
fn add_object(
    &mut self, 
    object_description: ObjectDescription<T>, 
    object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>[src]
&mut self,
object_description: ObjectDescription<T>,
object_behavior: Box<dyn ObjectBehavior<T>>
) -> Object<T>