-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
hand-controls component: broken features, performance. #5087
Comments
Thanks! Can you break the work in separate PRs to address issues independently? It makes it easier to review and understand. |
Not sure what the following code does:
|
also helpful if you can elaborate where you're seeing performance issues. |
I feel a bit stupid, but I actually just looked into the I hope you can forgive that error, that's honestly pretty embarrassing! I hadn't touched A-Frame in a few months and just papered over some puzzling behavior that threw me off by working around it instead of trying to understand what was going on underneath. I've included cleaning up that code in a pull request to NAF that also includes some other new features: networked-aframe/networked-aframe#358 Anyways, as to the other issues:
I've implemented an approach that I think is cleaner and consistent, and should be pretty easy to read (and is documented correctly in the docstring). Open to feedback.
In the most recent version I've submitted for a pull request to NAF, I've also added the ability to specify "controller" as a hand model. I don't assume you also want that feature in core, so I wouldn't expect to propose that here, but I'm happy to include that feature if that's interesting. |
Thanks so much. Can we open a PR to change the color of the hands? It looks like a bug. We should fix the events if they're not consistent. A separate PR will also help me understand better. It's been a while I haven't used hand-controls. Hand-controls predates Valve Index (and many other headsets. it's been around even before Oculus Touch controllers) and probably nobody cared until now :) A-Frame code is ES5 |
About tons of events emitted. Variables should be reused if we're not doing that already. We can look into those. We could also throttle the events if possible. |
The hand-controls component is a bit creaky--as it mentions in its own comments, it was originally just a proof of concept. It seems incomplete; as issue #4596 points out, the events are problematic, and the 'color' property doesn't affect the mesh. It also has a lot of room for improvement in terms of not being sufficiently dry, being written in a bit of an old fashioned style, and not being written in a way that is at all conscious of the effects on garbage collection.
When writing a version of this component for NAF, I went ahead and gave the component an overhaul, and ended up with this:
https://github.com/networked-aframe/networked-aframe/blob/master/src/components/networked-hand-controls.js
Would a pull request be welcome to add these changes over to core? Any comments on improving this code? Should I just make a pull request and we work from there?
Note: lines 20-40 are NAF-specific and can be ignored.
As you'll see, I have been working on a code style that minimizes garbage collection. You can see this in the
str
property and thethis.Y[this.Z]
pattern. (Because of other quiet object re-use patterns in A-Frame, there are very tricky pitfalls that show up when just assigning properties itself).I know it's unorthodox; I'd love feedback on a cleaner way to write this code, if you have ideas. If it's agreed that it's a good idea, though, it would be interesting to discuss ways to support this code style in A-Frame to help component authors reduce garbage collection by default, without tripping over some of the existing optimizations under the hood in A-Frame.
The text was updated successfully, but these errors were encountered: