- There is a new variant
HeightField
to theCollisionShape
enum
- HeightField collision shape (#102, thanks @elegaanz)
- The
CollisionEvent
now contains a pair ofCollisionData
instead of a pair ofEntity
- The physics step rate is not defined on the plugin type anymore. It is replaced by a
PhysicsSteps
resource. - The
IntegrationParameters
can no longer be defined when installing the plugin. TheIntegrationParameters
should should be inserted/mutated instead. - The
Velocity
andTransform
are now updated during theCoreStage::PostUpdate
. If a user-system need to run after the physics update, it should explicitly declares that dependency using thePhysicsSystem
labels.
- More data in collision events (#103)
SensorShape
component to mark individual collision shape as sensor (#104)- Runs physics step at most once per frame (#109)
- The
Body
component is renamed toCollisionShape
- The
BodyType
component is renamed toRigidBody
and is now mandatory. (The rigid bodies are no longer automatically "dynamic" when the component is not found) - The
BodyHandle
component is removed. The rapier'sRigidBodyHandle
andColliderHandle
are now used instead.
- Allow to define (multiple) collision shapes in the child entity of a rigid body (#97)
- Collision layers (#101)
- Frame delay after a spawn/update of the entity transform (#92)
- The acceleration component is now registered for bevy reflection
0.5.1 - 2021-05-01
The PhysicsTime
resource can be used to change the time-scale of the physics engine.
Thanks @yaymalaga
0.5.0 - 2021-04-18
The required version of rapier2d is bumped to ^0.8.0
A new public field friction
has been added in PhysicMaterial
.
As the name suggest, it allows to define the friction that should be applied when two rigid bodies are in contact.
Thanks @yaymalaga
0.4.0 - 2021-04-17
The required version of bevy is bumped to ^0.5.0 The required version of rapier2d is bumped to ^0.7.2 The required version of rapier3d is bumped to ^0.8.0
Heron no longer enables any feature flag for rapier. That way the end-user can freely choose the rapier feature flags.
0.3.0 - 2021-03-21
There is a new variant in the Body
enum: ConvexHull
. It takes a list of points, and the body shape will be the
smallest possible convex shape that includes all the given points.
Thanks @faassen
A new Acceleration
component make possible to apply and linear and angular accelerations.
It is by extension also possible to apply a force if you know the mass: acceleration.linear = force / mass
.
Thanks @ryo33
A new RotationConstraints
component make possible to prevent rotation around the given axes.
- The opacity has been increased for the default color of debug shapes.
0.2.0 - 2021-03-07
The physics step run at a fixed rate (60 updates per second by default). Therefore, it is not in sync with the frame update (that runs as many times per second as possible).
But a user may want to (and sometime have to) run system synchronously with the physics step.
This is why two stages are now public:
stage::ROOT
: the root schedule stage that contains the physics step and run at a fixed rate (60 updates per second by default)stage::UPDATE
: a child (parallel) system stage that runs before each physics step
But most of the time, users shouldn't have to use the stage directly,
because an add_physics_system
extension function on AppBuilder
is provided and can be used like add_system
, except
systems added with add_physics_system
will run during the physics update.
This is a breaking change: Updating the transforms/velocities or any other physics component of rigid bodies must be done in the physics update stage.
Make sure to add theses systems using the new add_physics_system
extension function on AppBuilder
.
There is now a PhysicMaterial
component which can be used to define both the restitution (how bouncy) and density (how heavy) the material is.
In the future it will be extended to define more physics properties, like the friction.
Since the restitution is now defined in PhysicMaterial
, the Restitution
component has been removed.
There is a new variant to BodyType
: Kinematic
. That makes possible to create "kinematic" bodies.
A kinematic body is controlled programmatically (usually by updating the transform) and affect the other bodies normally,
but is not affected by them.
The required version of rapier is bumped to ^0.6.1
All components now implement Default
and Reflect
and are registered to bevy reflect system.
That should make be possible to use heron components in serialized scene for hot-reloading.
BodyHandle
now has a public constructor. Advanced users may create rigid bodies and colliders using directly the rapier API (adding them to the RigidBodySet
and ColliderSet
resources), and then add a BodyHandle
component to the entity so that heron's will handle velocity and update the bevy transforms.
Tanks @MGlolenstine
0.1.1 - 2021-02-16
A problem happened during the release of 0.1.0
, and some crates (incl. the root crate heron
)
were requiring invalid version of the other heron crates.
0.1.0 - 2021-02-15 [YANKED]
The required rapier version is now >= 0.5.0 < 0.6.0.
The variants Body::Capsule
and Body::Cuboid
have been added, allowing creating respectively capsule and cuboid
collision shapes
By default, the rigid-bodies are dynamic. A BodyType
can be attached to make it:
- Static (with
BodyType::Static
) so that it doesn't move. - Sensor (with
BodyType::Sensor
) so it doesn't move and doesn't affect other bodies. (Only useful for listening to collision events)
- Misplaced debug render at startup
- Incorrect angular velocity in 2d
0.1.0-alpha.1 - 2021-01-30
3d
(enabled by default) Enable simulation on the 3 axesx
,y
, andz
. Incompatible with the feature2d
.2d
Enable simulation only on the first 2 axesx
andy
. Incompatible with the feature3d
, therefore require to disable the default features.debug
Render collision shapes. Works only in 2d for now, support for 3d will be added later.
Important: Either 2d
or 3d
(but not both) must be enabled. If none or both of theses two features are enabled,
the PhysicsPlugin
won't be available.
Add the PhysicsPlugin
to setup collision detection and physics simulation. It also registers rapier's RigidBodySet
, ColliderSet
, JointSet
, IntegrationParameters
, BroadPhase
and NarrowPhase
in the resources.
The resource Gravity
defines the world's gravity. Gravity is disabled by default. You may override or mutate
the Gravity
resource to change the world's gravity.
A Body
component can be added to make the entity a dynamic rigid body with the given shape.
The position of the body is defined by the bevy GlobalTransform
component. Updating the GlobalTransform
, will
teleport the body ignoring physics rules.
Every frame the Transform
will be updated to reflect the body position in the world.
Heron will automatically handle replacement and removal of the body (when the component mutated/removed or when the entity is despawned)
At the moment, only spheres are supported. More shape will be added in the future. Support for static and kinematic bodies will be added later too.
Add the Velocity
component to an entity to define/update or read the velocity of a dynamic body.
The entity, must also have a Body
component and a GlobalTransform
.
The Restitution
component can be added to define the restitution coefficient of a body.
One can read from Events<CollisionEvent>
to be notified when collisions start and stop.