I'm still having problems getting the lookAt method to work.  I'm getting
a scaling in the X & Y axes o fthe resulting transform.  The scaling is
exagerated if the Node is not in the same y-plane (world coordinates).

As I understand it, lookAt should NEVER give a scaling factor.

I should note that while my system appears to work (with the exception of
the scaling), there is one transform, vworldToSource, that is giving me
really weird results in the translation component.

The following is my code:

Here are my class constants:

  private static final Point3d ZERO_POINT = new Point3d( 0d, 0d, 0d );
  private static final Vector3d UP_VECTOR = new Vector3d( 0d, 1d, 0d );
  private static final Transform3D TURN_AROUND = new Transform3D();
    static { TURN_AROUND.rotY( Math.PI ); }

Here is the method I'm having trouble with (sans print statements):

  public void update() {
    // t1 = targetToVworld
    target.getLocalToVworld( t1 );
DebugJ3D.print( t1 );
    t1.transform( ZERO_POINT, _targetPoint );

    // t1 = sourceToVworld
    _source.getLocalToVworld( t1 );
DebugJ3D.print( t1 );
    // t1 = vworldToSource
    t1.invert();
DebugJ3D.print( t1 );
    t1.transform( _targetPoint );

    t1.transform( UP_VECTOR, _bodyUpVector );

    _source.getTransform( t1 );
    t1.setIdentity();
    t1.lookAt( ZERO_POINT, _targetPoint, _bodyUpVector );
    t1.invert();
    t1.mul( TURN_AROUND );
DebugJ3D.print( t1 );

    _source.setTransform( t1 );
  }

And here is the results of the print statements:

The nearly correct case: source is .4 meters higher than
  targetToVworld
    Scale = (0.09000000491738322, 0.09000000491738323, 0.090000004 )
    Rotation = (-0.8891261369633786, -0.3236160, -0.3236160, 1.68804001 )
    Translation = (-0.45000000670552254, 1.2000000, 0.449999962 )
  sourceToVworld
    Scale = (0.25, 0.25, 0.25)
    Rotation = (0.0, 0.0, 0.0, 0.0)
    Translation = (-0.3, 1.6499999910593033, -1.0)
  vworldToSource
    Scale = (0.25, 0.25, 0.25)
    Rotation = (0.0, 0.0, 0.0, 0.0)
    // Note this Translation does not make sense to me
    Translation = (1.2, -6.599999964237213, 4.0)
  lookAt result
    Scale = (1.0465629946027426, 1.0465629946027426, 1.00000000)
    Rotation = (0.94506888, -0.323215062, 0.048752791, 0.316538718 )
    Translation = (0.0, 0.0, 0.0)

The exagerated case: target is 1.15 meters lower than source.
  targetToVworld
    Scale = (0.090000004, 0.090000004,  0.090000004)
    Rotation = (-0.88912613, -0.3236160, -0.3236160, 1.68804001 )
    Translation = (-0.450000006, 1.20000004, 0.449999962 )
  sourceToVworld
    Scale = (0.25, 0.25, 0.25)
    Rotation = (0.0, 0.0, 0.0, 0.0)
    Translation = (-0.1, 2.3499999910593035, 0.0)
  vworldToSource
    Scale = (0.25, 0.25, 0.25)
    Rotation = (0.0, 0.0, 0.0, 0.0)
    // Note this Translation does not make sense to me
    Translation = (0.4, -9.399999964237214, -0.0)
  lookAt result
    Scale = (2.2514952, 2.25149523, 0.999999999 )
    Rotation = (0.83812622, -0.463518375, 0.28756762, 1.274431089 )
    Translation = (0.0, 0.0, 0.0)

===========================================================================
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".

Reply via email to