Hi Paul,
>
>If anyone is interested in the solution for the strange behavior:
>
>In one case the Transformation of the object is updated depending on the frame rate
>because the
>difference matrix is multiplied in the behavior and generates a new transformation
>every frame.
>In the other case the Transformation of the object is updated depending on input
>device
scheduler
>rate since the absolute transformation is calculated in the input device
>implementation.
>So depending which thread runs faster the objects are moving with different speed.
>
>So there is a difference if an input device delivers absolute data or relative data.
>Maybe this
is
>of some importance wen using more than one input device. Put it in the FAQ or
>documentation ?
>
>Paul
>
There are two issues here:
(1) The input device scheduler rate may be different from behavior
scheduler rate (which normally once per frame).
For input device scheduler, the rate is depending on
which mode to use.
InputDevice.BLOCKING mode:
---------------------------
A separate thread is create for each
device to continously read from input, basically
while (true) {
device.pollAndProcessInput();
this.yield();
}
So the rate is up to how long the device is blocking during read.
InputDevice.NON_BLOCKING mode:
------------------------------
A timer thread in Java3D will trigger an event to the
InputDeviceScheduler thread every 5ms to read input from device.
This sampling rate (default 5ms) can be changed using the
property -Dj3d.deviceSampleTime when java startup.
InputDevice.DEMAND_DRIVEN:
-----------------------------
It is up to the user program when to invoke device.pollAndProcessInput();
So it is normal that using the behavior thread and user the input device
will have different rate.
(2) Another factor is the numerically error build up during the process.
In the first method it seems that the transformation matrix is set
directly using loookAt(). So the matrix compute is pretty accurate
based on the current device value.
However in second method it seems to me that the transformation matrix
is computed base on the current one multiple by the transformation matrix
read from device. After a while numerically error will build up in
the current transformation matrix. This may intensify in the long
run so it appears that this rate is run differently from using
the first method.
- 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".