What exactly is wrong with the cylinders? Without seeing a short code sketch or at least a picture it's hard to tell what is wrong with your method.
If I had to guess, I'd probably take a look at the order of your transformations. Make sure your displacement of the second cylinder is happening before the transformation (if you reverse these you will get two parallel cylinders positioned on top of each other vertically). Alex -----Original Message----- From: osg-users [mailto:[email protected]] On Behalf Of Laura Mac Sent: Wednesday, May 28, 2014 2:15 AM To: [email protected] Subject: [osg-users] Finding position of top of rotated cylinder HI all, Apologies in advance for a very elementary question! Let's say I render a vertically aligned cylinder and rotate this cylinder 20 degrees about the x axis. Now let's say I render another cylinder of the same dimensions and I rotate it in an identical manner. What I want to do is place the second cylinder directly on top of the first cylinder such that the two cylinders resemble one long cylinder mesh. How would I do this? This is the logic of what I have tried so far (and has not given visually accurate results): I would need access to the position of the top of the first cylinder. I would be able to do this by adding the cylinder's length to its y position. However, this would give me the top of the non-rotated cylinder, and I am looking for the position at the top of the rotated cylinder. I am aware that I can also create a position vector of the top of the nonrotated cylinder and multiply this by a rotation matrix to determine the position vector of the top of the rotated cylinder. Then, I assume that the rotated top position vector must correspond to the second cylinder's position after the second cylinder has undergone rotation. Thus, I must determine the initial position to set the second cylinder at in order to have the second cylinder's position match the top position of the first cylinder after rotating the second cylinder. To do this, I multiply the first cylinder's top position vector by the inverse of the rotation matrix, which I assume yields me the initial position to set the second cylinder at. I then set the second cylinder's position as the afore-computed position vector, and I apply a rotation to the second cylinder. This method is not directly placing the second cylinder above the first, however. Could anyone let me know what I am doing wrong? Thanks! ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59586#59586 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

