-
Notifications
You must be signed in to change notification settings - Fork 71
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
activatable reaction component #148
base: master
Are you sure you want to change the base?
Conversation
provides bindings for secondary activations while an object is being grabbed. configurable to allow specifying a specific button event, to allow you to have multiple activatable components on an object (this may not be the best way to do this)
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.
Thanks for getting this going! Looking forward to building it out together and getting it setup with a testing suite.
index.js
Outdated
deactivated = this.state.get(this.DEACTIVATE_EVENT) | ||
} | ||
if (deactivated) { | ||
this.state.set(this.DEACTIVATE_EVENT, deactivated) |
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.
Do you have a need for storing the last activated entity on the state? So far, the gestures only track the current interaction.
index.js
Outdated
activated = this.state.get(this.ACTIVATE_EVENT) | ||
} | ||
if (activated) { | ||
this.state.set(this.ACTIVATE_EVENT, activated) |
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 this is unreachable - I don't see another place where the activated state is set, so the condition would always be false
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.
Grabbing an object with two hands? nevermind
index.js
Outdated
const carried = this.state.get(this.GRAB_EVENT) | ||
let activated = this.state.get(this.ACTIVATE_EVENT) | ||
if (carried) { | ||
if (!activated && !this.emitCancelable(carried, this.ACTIVATE_EVENT, {hand: this.el, buttonEvent: evt})) { |
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.
This would mean only an entity which is already the grabbed entity can be activated. In this respect, it wouldn't be much different from the drag gesture. What would you say to making this a more general gesture, just the act of pressing a button while targeting an entity? I'm thinking this way the activatable
component would replace the clickable
component and do a better job of what it has been trying to do without interfering with grabbing. When you do want an activation that is dependent on also being grabbed, that logic could be handled within the reaction component instead.
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.
This was definitely intended to be similar to draggable
, but more generic and customizable (since you can specify exactly what state to set on the objects so you can have multiple). Also, given clickable
exists, I didn't see the need to allow activatable
to work on ungrabbed objects. I am not opposed to rolling all three of these together since they are pretty similar.
It occurs to me the latest version I've pushed of this is still not quite what I would like, as I would like to customize state set on the super-hands as well (not just the state set on the objects). The problem is I don't know the best way to have that value defined on the reaction component, but read by the super-hand. |
I have run
npm run test:machinima
, and this patch passes all machinima tests: noThis is very WIP right nowprovides bindings for secondary activations while an object is being grabbed. configurable to allow specifying a specific button event, to allow you to have multiple activatable components on an object (this may not be the best way to do this)