-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
Hi @alvarosabu, I just added a base documentation for cc: @JaimeTorrealba |
- Init joint component - Add `JointProps` interface - Add Joint Demo
683f466
to
8c4afea
Compare
Any update on this one?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the implementation, But also I would add a composable WDYT? With the same logic
an useJoint()
or similar so the people is not force to use it with Tres.js components only
} | ||
}, | ||
|
||
"cSpell.words": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the settings should be removed here, this is personal to our environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it ✅
|
||
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small one but maybe we need consistency here it all pages should be "Tres.js"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted
|
||
<template> | ||
<RigidBody | ||
v-for="(ref, i) in bodyRefs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a problem, the mental load of this example is high. I would instead, in this page, come with a very basic example, just two rigid Bodies joined (just that). The idea here is that they learn how to use it.
Array.from({ length: 10 }).map(() => shallowRef<ExposedRigidBody>(null)), | ||
) | ||
|
||
setInterval(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why setInterval?
And if you decided to use setInterval, please remember to clear the interval in the onUnmouted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, you're right,
setInterval
was used to update the rotation of the first and have that whip effect
} | ||
|
||
if (hasParamsError) { | ||
throw new Error(`Invalid "${type}" joint parameters`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe too difficult, but could be said what parameters have problems?
I think it possible even to have both features |
Completely, maybe another PR to be more organized. |
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
"fixed" | "spring" | "rope" | "generic" | "spherical" | "prismatic" | "revolute"
FixedJoint
,SphericalJoint
, ...)How to use
Here's a basic implementation example:
Screen.Recording.2024-11-20.at.2.10.27.AM.mov