-
Notifications
You must be signed in to change notification settings - Fork 527
Add body tracking sample #178
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
base: main
Are you sure you want to change the base?
Conversation
|
This is amazing! |
toji
left a comment
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.
As you said, this is just an FYI for now but I've got some comments for you anyway!
proposals/body-tracking.html
Outdated
| const material = new THREE.MeshLambertMaterial(); | ||
|
|
||
| spheres = new THREE.InstancedMesh( geometry, material, body.size ); | ||
| spheres.translateZ( -1 ).setRotationFromMatrix (new THREE.Matrix4().makeRotationY(Math.PI)); |
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'm not clear on how this works, and it's probably worth a comment for developers sake.
My guess is that this is a transform applied to the entire collection of instances spheres as a sort of root transform? If so, how does this result in the behavior in the video you linked, which appears to mirror your movements rather than show them rotated 180? (Although to be fair you never really moved your hands one at a time, so it's hard to tell. Full body movement suggests a mirror instead of a rotation, though.)
In any case, more comments throughout would be welcome!
proposals/body-tracking.html
Outdated
| matrix.identity(); | ||
| } | ||
|
|
||
| matrix.setPosition( -position.x, position.y, position.z ); |
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, and I see that the positions are being inverted in X here too? Is THAT what causes the mirroring effect?
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.
yes :-)
c591ea1 to
795d0cc
Compare
| if (!part.jointName.includes("hand")) { | ||
| scaledMatrix.makeScale(3, 3, 3); | ||
| } else { | ||
| - scaledMatrix.identity(); |
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.
What's the - here? Typo or leftover from a merge? Does this code run?
FYI @toji
example video:
https://github.com/immersive-web/webxr-samples/assets/1513308/6e5227c6-d451-4846-a0a2-6607bfcce627