• Qt irrlicht(鬼火)3D引擎 摄像机旋转问题


    点击打开链接Irrlicht中的摄像有一个函数 setUpVector()

    
    
    if (m_device != 0 )
        {
            core::vector3df rotation(y,x,0.f);
            m_camera->setRotation(rotation);
    
            f32 viewlength = m_camera->getTarget().getLength();
    
            f32 angle = z*2*Pi/360.0;
    
            m_camera->setUpVector(vector3df(viewlength*cos(angle),viewlength*sin(angle),0.0f));
    
        }


    具体用法参考上面

    还有一个方法旋转摄像机

    是控制另一轴的旋转

    void Scene_3D::slotUSBENGINE(f32 x, f32 y, f32 z)
    {
        core::vector3df pos = m_camera->getPosition();
        core::vector3df target = (m_camera->getTarget() - m_camera->getAbsolutePosition());
        core::vector3df relativeRotation = target.getHorizontalAngle();
        target.set(0,0, core::max_(1.f, pos.getLength()));
        core::vector3df movedir = target;
        core::matrix4 mat;
        mat.setRotationDegrees(core::vector3df(relativeRotation.X, relativeRotation.Y, 0));
        mat.transformVect(target);
        movedir = target;
        movedir.normalize();
        pos += movedir*0.5f*(x/5);
        core::vector3df strafevect = target;
        strafevect = strafevect.crossProduct(m_camera->getUpVector());
        m_camera->setPosition(pos);
        target += pos;
        m_camera->setTarget(target);
    
        //    qDebug()<<"hjsdfjhkgsdfgjhksdfajhgksadfjhklsdfahjklsdfakhjlsakjhlsdfhkjsdfajhklsafkjhlsfajhklsfdahjklfsdahjklfsdahjklsfjkhlsd";
    
    }


  • 相关阅读:
    tc: Linux HTTP Outgoing Traffic Shaping (Port 80 Traffic Shaping)(转)
    Linux TC的ifb原理以及ingress流控-转
    插件+组件+空间
    Q查询条件
    django中的分页标签
    QuerySet
    url
    view
    HttpReponse
    装饰器
  • 原文地址:https://www.cnblogs.com/DreamDog/p/9160121.html
Copyright © 2020-2023  润新知