Jump to content

Problem of Rotation


photo

Recommended Posts

When I rotate the helicopter in the Y axis, the rotation in X-axis (roll) also changes.  How to fix the problem, thanks.

 

RotateNode(helicopterNode, Math::quat(0, 1, 0, -val2 * movement_speed *Game::get()->getIFps()));   

// when it runs, rollValue = helicopterNode->getRotation().getAngle(vec3 (1,0,0)) the rollValue will also change  

    int RotateNode(Unigine::NodePtr node, Unigine::Math::quat rotationDirection)
    {
        // getting current node transformation matrix
        Unigine::Math::Mat4 transform = node->getTransform();

        // calculating delta rotation around an arbitrary axis
        Unigine::Math::quat delta_rotation = Unigine::Math::quat(rotationDirection);

        // setting node's scale, rotation and position

        node->setRotation(node->getRotation() * delta_rotation);

        return 1;
    }

 

Link to comment
×
×
  • Create New...