#bevy #animation #gamedev

bevy_fabrik

IK solver for Bevy using FABRIK algorithm

2 releases

new 0.1.1 Nov 1, 2024
0.1.0 Oct 23, 2024

#910 in Game dev

Download history 167/week @ 2024-10-20 111/week @ 2024-10-27

278 downloads per month

MIT/Apache

3MB
300 lines

bevy_fabrik

An implementation of FABRIK inverse kinematics algorithm for Bevy game engine.

example

Disclaimer: multi-chain support is not implemented yet.

How to use

Add InverseKinematicsPlugin to your App:

app.add_plugins(InverseKinematicsPlugin);

Add IkChain component to the last entity (tail) of a chain of entities you want to control:

commands.entity(chain_tail).insert(IkChain::new(joint_count));

Note that IkChain will calculate bone lengths based on the distance between entities in the chain when inserted, so make sure the entities and their transforms are set up correctly before inserting it.

Finally, update IkChain's target field as needed to solve the chain towards it. For a more complete example, see examples/basic.rs.

To add joint constraints, insert TwistConstraint and/or SwingConstraint components to the entities within the chain, and they will be applied during chain solving.

Compatibility

Bevy bevy_fabrik
0.14 0.1

Alternatives

License

Dual-licensed under either:

at your option.

Dependencies

~24MB
~456K SLoC