Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Translation of a scene node

Translation of a scene node

Scheduled Pinned Locked Moved Game Development
1 Posts 1 Posters 693 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunil.nair
    wrote on last edited by
    #1

    Hi, I am new to QT. I am trying to move an object from one point to another in this function. But, rather than translating the object, QT creates a copy of the cube. How can I use translation.
    @
    CubeView::CubeView(QWindow *parent)
    : QGLView(parent)
    {
    //! [1]
    QGLBuilder builder1;
    builder1 << QGL::Faceted;
    builder1 << QGLCube(1);
    cube = builder1.finalizedSceneNode();

    QGLBuilder cursor_builder;
    cursor_builder <<QGL::Faceted;
    cursor_builder <<QGLCube(1);
    cursor=cursor_builder.finalizedSceneNode();
    
    //camera setup
    camera()->setFieldOfView(35);
    camera()->setNearPlane(1);
    camera()->setFarPlane(10);
    

    //! [2]
    logo.setImage(QImage(QLatin1String(":/blackcircle.jpg")));
    //initialize Haptics
    initHaptics();
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
    timer->start(500);

    }
    //! [2]
    void CubeView::update()
    {
    //QGLPainter *paint= new QGLPainter;
    cube->setPosition(p2);
    std::cout<<"Hello \n";
    //paintGL(paint);
    }
    @
    Instead of moving the cube, QT creates another copy of the cube. Could you suggest something? Thanks.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved