instantreality forum
news: Welcome to the instantreality forums!
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 19, 2018, 05:54:35 am

Login with username, password and session length

Pages: [1]
Author Topic: Joystick problem  (Read 1179 times)
Posts: 2

View Profile
« on: June 19, 2015, 12:20:27 pm »

I have had some problem with scripting a task for a robot in VRML. I have this rotational joint and i want to move it by pressing a button of a joystick.When pressing the button the rotation shall begin and continue until I release the button.
The basic idea was to resend the incoming event to create a "asynchronous" loop. In detail, the button event is routed to the EventIn "botton1clic" of my script. The function applies a small rotation and then it sends an event to another script, which fires a new event to "botton1clic". So the loop starts again. To exit this infinite loop the functions checks if the button is still pressed.

This is an excerpt of my script:

      function botton1clic(botton1)
         if (joystick.botton1clicOut)
            yax = yax + 0.1;
            joystick.botton1clicScript = true;

Unfortunately, it doesn't work. The function is called once after pressing the joystick button but the recursion doesn't start.

If anyone has some idea or can help me find a solution I will be really thankful.
Thank you
Jr. Member
Posts: 89

View Profile
« Reply #1 on: July 07, 2015, 12:53:21 pm »

Hello BeEng,

maybe you could trigger a TimeSensor node to continuously fire events which will run the rotation? The button event is only fired once because there is no differentiation between a button being pressed and a button being held down.

Pages: [1]
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines