Coder Social home page Coder Social logo

Comments (7)

skalarproduktraum avatar skalarproduktraum commented on August 24, 2024

The place this probably goes wrong should be

while(VRSystem_PollNextEvent(event)) {
val role = when(VRSystem_GetControllerRoleForTrackedDeviceIndex(event.trackedDeviceIndex())) {
ETrackedControllerRole_TrackedControllerRole_LeftHand -> TrackerRole.LeftHand
ETrackedControllerRole_TrackedControllerRole_RightHand -> TrackerRole.RightHand
ETrackedControllerRole_TrackedControllerRole_Invalid -> TrackerRole.Invalid
else -> TrackerRole.Invalid
}
logger.debug("Event ${idToEventType(event.eventType())} for role $role")
if(event.eventType() == EVREventType_VREvent_ButtonPress) {
val button = event.data().controller().button()
OpenVRButton.values().find { it.internalId == button }?.let {
logger.debug("Button pressed: $it on $role")
val keyEvent = it.toKeyEvent(role)
GlobalKeyEventDispatcher.getInstance().dispatchKeyEvent(keyEvent.first)
inputHandler.keyPressed(keyEvent.first)
keysDown.add(it to role)
GlobalKeyEventDispatcher.getInstance().dispatchKeyEvent(keyEvent.second)
}
}
if(event.eventType() == EVREventType_VREvent_ButtonUnpress) {
val button = event.data().controller().button()
OpenVRButton.values().find { it.internalId == button }?.let {
logger.debug("Button unpressed: $it on $role")
val keyEvent = it.toKeyEvent(role)
GlobalKeyEventDispatcher.getInstance().dispatchKeyEvent(keyEvent.second)
inputHandler.keyReleased(keyEvent.second)
keysDown.remove(it to role)
}
}
if(event.eventType() == EVREventType_VREvent_MouseMove) {
val x = event.data().mouse().x()
val y = event.data().mouse().y()
val down = event.data().mouse().button()
logger.debug("Touchpad moved $x $y, down=$down")
}
}

from scenery.

moreApi avatar moreApi commented on August 24, 2024

Same behavior for button Side,Trigger and A and probably all others

from scenery.

skalarproduktraum avatar skalarproduktraum commented on August 24, 2024

Okay, so this is probably not an oversight, but an actual semantic error -.-

from scenery.

moreApi avatar moreApi commented on August 24, 2024

line 566 of the excerpt above is the cause of pressed keys being empty.
But withouyt that line no VR button works anymore.
At least for drag behaviors that is because https://github.com/scijava/ui-behaviour/blob/9cbc0df842c240e36af48b48fc294ea8c982a63d/src/main/java/org/scijava/ui/behaviour/MouseAndKeyHandler.java#L440 only does exact matching and since there is always this axis or proximity thing pressed it always returns false.
There is something about "irgnored keys" in that match function. But this whole thing looks like highe magic to me.

from scenery.

skalarproduktraum avatar skalarproduktraum commented on August 24, 2024

Input handling is one of the darkest kinds of magic.

from scenery.

skalarproduktraum avatar skalarproduktraum commented on August 24, 2024

Jokes aside - I'd argue here it'd likely be best to allow only the actual buttons to trigger events, and and ignore the proximity sensor. What do you think, @moreApi?

from scenery.

moreApi avatar moreApi commented on August 24, 2024

I dont think we need to care about the proximity sensor 👍

from scenery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.