Just my 2 cents to that: Build your cylinder so that the axes is along the negtive z axis with the center of the bottom base at (0,0,0) and the center of the top base at (0,0,-length).
Then use the inverse transformation generated by the lookAt method with the 2 points which define the position as center and eye. Since the cylinder is symmetric you can use any vector with length > 0 as up vector. regards Paul "Graeme R. Foot" schrieb: > Have attached modified code... > (look for // MOD GF for changes.) > > Main change, your angle calc was the difference between the two point vectors. > This needed to change to be the angle between the cylinder axis and the new > axis, (see the second attachment) and subsequently the orthagonalAxis changed > also. > > The second change was in the translation: > originVec.sub(diffVec); > changed to: > originVec.add(diffVec); > > The third change was to put the rotation transform after the translation > transform. > > Hope this helps, > G. > > -----Original Message----- > From: John Nelson [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 4 October 2001 07:31 a.m. > Subject: Re: This doesn't work quite right... > > Man... I can't believe I wrote that slop. > > If you run the test program I just posted, you will see a cylinder > object rooted at the origin of the scene and a sphere. All well and > good, but the cylinder ends out in free space someplace. It should > connect to the blue sphere, but its pointing off in the wrong direction. > > Since my last posting I cleaned up the translation from the cylinder > origin and put it after the rotation, but it still doesn't work. Really > strange.... > > -- John > > ------------------------------------------------------------------------ > Name: Test.java > Test.java Type: JavaScript Program (application/x-javascript) > Encoding: quoted-printable > > Name: calc angles.bmp > calc angles.bmp Type: Bitmap (image/bmp) > Encoding: base64 =========================================================================== 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".
