Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Joints implementation #150

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat: Joints implementation #150

wants to merge 8 commits into from

Conversation

Neosoulink
Copy link
Collaborator

@Neosoulink Neosoulink commented Nov 20, 2024

Summary

This PR introduces the Joints feature.

Joints are one of the advanced features natively available in Rapier.
This PR provides an easy, basic but robust way to deal with it.

Logs

  • Support for Joint types:
    • "fixed" | "spring" | "rope" | "generic" | "spherical" | "prismatic" | "revolute"
  • New components based on the supported joint types (FixedJoint, SphericalJoint, ...)

How to use

Here's a basic implementation example:

<RigidBody
  v-for="(ref, i) in bodyRefs"
  :key="i"
  :ref="ref"
  :type="i === 0 ? 'kinematic' : 'dynamic'"
  :position="[i * 1.5, 0, 0]"
   collider="ball"
 >
  <TresMesh>
    <TresSphereGeometry />
    <TresMeshNormalMaterial />
  </TresMesh>
</RigidBody>

<SphericalJoint
  v-for="(ref, i) in bodyRefs"
  :key="i"
  :bodies="[ref.value?.[0]?.instance, bodyRefs[i - 1]?.value?.[0]?.instance]"
  :params="[
    [-1.1, 0, 0],
    [1.1, 0, 0],
  ]"
/>

Preview

Screen.Recording.2024-11-20.at.2.10.27.AM.mov

Will close #108

@Neosoulink Neosoulink self-assigned this Nov 20, 2024
@Neosoulink Neosoulink marked this pull request as draft November 20, 2024 00:19
@Neosoulink Neosoulink marked this pull request as ready for review December 9, 2024 14:05
@Neosoulink
Copy link
Collaborator Author

Hi @alvarosabu, I just added a base documentation for Joint.
I'd appreciate having your review of it (the Joint implementation in general).

cc: @JaimeTorrealba

@Neosoulink Neosoulink added enhancement New feature or request feature p3-significant High-priority enhancement (priority) labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature p3-significant High-priority enhancement (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joints
1 participant