diff --git a/docs/components/joint.md b/docs/components/joint.md new file mode 100644 index 0000000..25d5671 --- /dev/null +++ b/docs/components/joint.md @@ -0,0 +1,66 @@ +# Joints + +Joints is an extension feature provided in [Rapier#Joint](https://rapier.rs/docs/user_guides/javascript/joints/). It lets us connect two or more bodies, restricting their movements according to each other. + +In **Tres** we can achieve such motion restriction by using one of the available components designed to handle joints: + +- [GenericJoint](../../src/components/joints/index.ts#L41) +- [PrismaticJoint](../../src/components/joints/index.ts#L51) +- [RevoluteJoint](../../src/components/joints/index.ts#L60) +- [RopeJoint](../../src/components/joints/index.ts#L69) +- [SphericalJoint](../../src/components/joints/index.ts#L78) +- [SpringJoint](../../src/components/joints/index.ts#L86) + +All of them extends [BaseJoint](../../src/components/joints/index.ts#L96). + +## How to use + +Here's a basic `Joints` implementation in **Tres**: + +```vue + + + +``` + +> Preview +Screenshot 2024-12-09 at 4 01 58PM + +### Explanation + +In the above example, we created a list of 10 `RigidBody` references and mapped them using the `v-for` directive. Then, we implemented the `SphericalJoint` component, creating a Joint between each mapped `RigidBody`. + +:::info +To understand how each Joint type works, please take a look at the official [Rapier Joint Documentation](https://rapier.rs/docs/user_guides/javascript/joints). +:::