Module crystalorb::world[][src]

Expand description

Contains traits for CrystalOrb to interface with your game physics world, along with internal structures that interfaces directly with your world.

Structs

Tweened

This is the result when you interpolate/“blend”/“tween” between two DisplayStates of adjacent timestamps (similar to “Inbetweening” in animation - the generation of intermediate frames). You get the DisplayState and a floating-point, non-whole-number timestamp.

Traits

DisplayState

The DisplayState represents the information about how to display the World at its current state. For example, while a World might contain information about player’s position and velocities, some games may only need to know about the position to render it (unless you’re doing some fancy motion-blur). You can think of a DisplayState as the “output” of a World. There is nothing stopping you from making the DisplayState the same structure as the World if it makes more sense for your game, but most of the time, the World structure may contain things that are inefficient to copy around (e.g. an entire physics engine)

World

Structures that implement the World trait are structures that are responsible for storing and simulating the game physics. The World is a simulation that is updated using its Stepper::step implementation. Players and any game logic outside of the physics simulation can interact with the physics simulation by applying commands to the World (for example, a command to tell player 2’s rigid body to jump, or a command to spawn a new player rigid body).