Expand description
§Amethyst Physics
The amethyst_physics
crate, provides an easy to use, interface to control any physics engine; as long as
they implement the PhysicsBackend.
Doesn’t exist the perfect physics engine that is good in all situations, and may be necessary try more engines in order to use the one that perform better depending on the game needs. Even worst, sometimes is not obvious from the start that a physics engine is not meant to do a specific task, (which unfortunately is even the main feature of the game), and when it get realized is too late.
To avoid this unpredictable, and not cute, surprises; amethyst_physics
allow to change at any stage of
the game development, the physics engine without changing any part of the game.
At the same time, amethyst_physics
doesn’t force to use the physics engine through its interfaces.
In this way, when a physics engine provides a special functionality, that doesn’t fit the
amethyst_physics
concept, it is still possible to use.
The interface is broken in servers (available servers), and each of them provides access to a specific part part of the engine. For example, is possible to create a new world using the function create_world.
§How to initialize amethyst_physics?
Initialize amethyst_physics
is really simple, and the only thing that you need to do is to register
the PhysicsBundle.
use amethyst_physics::PhysicsBundle;
use amethyst::amethyst_nphysics::NPhysicsBackend;
let game_data = GameDataBuilder::default()
.with_bundle(PhysicsBundle::<f32, NPhysicsBackend>::new()).unwrap()
That’s it! Enjoy! Physicsing
Modules§
- conversors
- This module contains the necessary functions to convert an Amethyst f32 object to generic physics object.
- objects
- This module contains all object types (like the physics tags) that are exposed trough
amethyst_physics
. - prelude
- Contains common types that can be glob-imported (
*
) for convenience. - servers
- The servers are the
amethyst_physics
interfaces, that is possible to use in order to control ary physics engine that implements them.
Structs§
- Physics
Bundle - To use the
amethyst_physics
crate is necessary to register thePhysicsBundle
as show below. - Physics
Time - This resource is used by
amethyst_physics
to keep track of the physics time.
Traits§
- Physics
Backend - This trait, is used to create a
PhysicsWorld
object, which contains the physics servers. - PtReal
- amethyst_physics real