Jump to content

[SOLVED] Viewport, GUI buttons and players


photo

Recommended Posts

Hello. I tried to use a viewport in our application and met two problems. I used ViewportWidgetQt class from examples, Qt 5.5.1, Unigine 2.3.

 

1) As I can see, viewport don't send to Unigine keyboards and mouse events. So, I can not use standard player controls (i.e. of PlayerSpectator) to move camera and I should implement it in C++ code or there is some way to do it?

 

2) Gui buttons are drawed only in main window, not in viewport. For my task, I wanted to see them in both windows or may be only in viewport.

And even if buttons would be drawed, I could not click on them, because of the problem from first question.

Link to comment

Hi,

 

Our controls are indeed designed to be used with only main viewport. You can try to pass controls to the Qt vieweport by yourself - something like that:

void ViewportWidgetQt::mousePressEvent(QMouseEvent *event)
{
 if (event->button() & Qt::LeftButton)
  mouse_button |= Unigine::App::BUTTON_LEFT;
 ...
 Unigine::App::get()->setMouseButton(mouse_button);
 QWidget::mousePressEvent(event);
}

With that method I think you should be able to get controls working with viewports.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • silent changed the title to [SOLVED] Viewport, GUI buttons and players
×
×
  • Create New...