>>     Is there some (clever) way to make a tranform (like the one for the
>> ViewingPlatform) go x distance in the direction it is facing (rotated to),
>> short of doing the trig on the rotation angles one at a time?  I guess I
>> want is a function like
>>
>>     void moveWherePointed(Transform t1,float moveAmt)
>
> think you are going to have to do some trig... sorry.

Just a little vector math.

The ViewPlatform transformation takes points from ViewPlatform coordinates
into virtual universe coordinates (this is the inverse of what is usually
considered the view transform).  Assuming only rotations, translations, and
uniform scales have been applied, then the columns of the upper 3x3 elements
of the ViewPlatform transformation matrix contain the orthogonal basis
vectors of the ViewPlatform coordinate system.

The third column of this upper 3x3 matrix is the Z basis vector and points
away from the object of interest.  So to get your propagation vector, just
normalize and negate this column vector.  Then to move X units along it you
just scale it by X and use that as the translation component of a
Transform3D object.  To move the ViewPlatform concatenate the current
ViewPlatform transformation with the result.

-- Mark Hood

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