>Delivered-To: [EMAIL PROTECTED]
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>X-Priority: 3 (Normal)
>X-MSMail-Priority: Normal
>Importance: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
>Date: Thu, 30 Aug 2001 13:54:50 +0100
>From: Sky Rumsey <[EMAIL PROTECTED]>
>Subject: [JAVA3D] SensorRead.getButtons
>To: [EMAIL PROTECTED]
>
>Hi all,
>
>I have updated the Magellan Spacemouse java class to read buttons. However,
>when I set the the Sensor reading, I cannot call upon the buttons array from
>the behaviour.
>
>
>In the Deivce class I have something like:
>
>
> case BUTTON1:
> button_down[0] = BUTTON1;
> //System.out.println(BUTTON1); // Prints out the assigned value, it is
not
>0!
>
> sens.setNextSensorRead(System.currentTimeMillis(), new
>Transform3D(rotation,translation,1),buttons);
>
>In the behavior class I have:
>
> sensRead.get(currXform);
>
> sensRead.getButtons(buttons);
>
>where currXform is a transform, and buttons is an int[]. The currXform works
>fine, however, when I do a button count or print out the first buttons[0], I
>always get 0, though I know this not be the case.
>
>I have tried using
>
> sens.lastButtons(buttons);
>
>but does the same.
>
>I have found no examples that pass in buttons, even from
>http://www.cyber.koganei.tokyo.jp/vr/ site!
>
>Can someone, help. I was happy with myself at working out decoding the
>button packets, I thought the rest would be simple but it's not happening!
>
>Thanks for your support.
(1) Use SensorRead constructor with numButtons
e.g. public SensorRead(int numButtons)
instead of public SensorRead()
public void getButtons(int[] values)
return values only if numButtons > 0
(2) Similarly use a Sensor constructor with
sensorButtonCount > 0
public Sensor(InputDevice device, int sensorReadCount,
int sensorButtonCount)
sens.setNextSensorRead() will not set
buttons reading if sensorButtonCount <= 0
But it can set currXform.
- Kelvin
----------
Java 3D Team
Sun Microsystems Inc.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".