Hi, I'm trying to make some rotation of objects, but the results are not the 
desired

I want to draw the coordinate axis. The following function draw an axis with 
the given rotation:


Code:
osg::PositionAttitudeTransform* createAxis(osg::Vec4f color, osg::Quat 
rotation){
        
        osg::StateSet* axisStateSet = createColorStateSet(color);
        osg::Geode* axisGeode = new osg::Geode();
        osg::Cylinder* axisCylinder = new 
osg::Cylinder(osg::Vec3(0.0f,0.0f,0.0f), 20, 50000);
        osg::ShapeDrawable* axisDrawable = new osg::ShapeDrawable(axisCylinder);
        axisDrawable->setStateSet(axisStateSet);
        osg::PositionAttitudeTransform* axisTransform = new 
osg::PositionAttitudeTransform;
        axisTransform->setAttitude(rotation);
        axisGeode->addDrawable(axisDrawable);
        axisTransform->addChild(axisGeode);

        return axisTransform;
}



And the following function draw the 3 axis giving the rotations:

Code:
osg::Group* createCoordinatesAxis(){
        
        osg::PositionAttitudeTransform* xTransform = 
createAxis(osg::Vec4f(1,0,0,1), osg::Quat(osg::DegreesToRadians(90.0), 0, 1, 
0));
        osg::PositionAttitudeTransform* yTransform = 
createAxis(osg::Vec4f(0,1,0,1), osg::Quat(osg::DegreesToRadians(90.0), 0, 0, 
1));
        osg::PositionAttitudeTransform* zTransform = 
createAxis(osg::Vec4f(0,0,1,1), osg::Quat(0, 1, 0, 0));

        osg::Group* axisGroup = new osg::Group();
        axisGroup->addChild(xTransform);
        axisGroup->addChild(yTransform);
        axisGroup->addChild(zTransform);

        return axisGroup;
}



The result is in the following image, but the axis (red, green and blue) are 
not turned 90 degrees!!! do someone know why???

Thank you!

Cheers,
Manuel[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=24030#24030



<<attachment: axis.JPG>>

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to