Triggering Touch Objects with Keyboard Input

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

Post Reply
mtyndorf
Posts: 3
Joined: 24 Oct 2019, 15:14

Triggering Touch Objects with Keyboard Input

Post by mtyndorf » 24 Oct 2019, 16:22

Hey Guys

Bit of a new user here, but I have an application that uses touch objects as targets via a touchscreen. Think of something similar to a dartboard.

The user throws a ball at the screen target which registers a hit on a touch object, but in case the touch screen doesn't respond quickly enough (and its an obvious hit) I need to be able to have a moderator hit a key on the keyboard to trigger the selected target.

I've tried using Keyboard inputs but the direction in the hierarchy is wrong.. I need it to accept a keypress input and trigger a touch object instead of the touch object triggering a keyboard input.

I'm sure this is pretty simple but I'm just not seeing it right now. Any thoughts?

Thanks!

User avatar
lerou
Posts: 315
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Triggering Touch Objects with Keyboard Input

Post by lerou » 25 Oct 2019, 11:38

Your triggers (key and touch) should not try to trigger each other. Instead both should trigger whatever reaction you have. So for instance, if you have an animation and your touch object triggers next on that animation, your node for the key should also trigger that next method.

More generally you could create a trigger container that contains both your touch node and a key node. And they both trigger an event. The event node's outgoing fired event is then exposed, so from outside the container it's transparent whether a touch or a key has triggered the output event. Then react to that event.

mtyndorf
Posts: 3
Joined: 24 Oct 2019, 15:14

Re: Triggering Touch Objects with Keyboard Input

Post by mtyndorf » 25 Oct 2019, 16:27

That's what I understand, but whenever I try tying the Emit event from the keypress to the Mover node which does the animation, the directional arrow is going from the Mover to the WindowKey node. From what I understand the arrow needs to go from the Keyboard node TO the mover node in order to trigger the motion, but I don't understand why it won't let me... is there a way to change the direction of the arrow or am I supposed to use something other than the "Emit" attribute to send the command to the mover node?

User avatar
lerou
Posts: 315
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Triggering Touch Objects with Keyboard Input

Post by lerou » 28 Oct 2019, 09:55

Emit is a method, so it's an input. You need to drag the Mover's Nudge merhod (input) to on of the Key's outgoing events (KeyDown or KeyUp)

Post Reply