Jump to content

Search the Community

Showing results for tags 'mouse'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • Showcase
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 7 results

  1. Does anyone have any idea how I can properly have the mouse grabbed within the app without needing to click inside the window after changing the MouseHandle? I've followed this guide and I've been able to get the mouse to grab and everything works properly. The caveat is that the mouse is only grabbed after clicking inside of the window after changing the MouseHandle. I've tried to do it by directly setting App.MouseGrab to true and it has most of the behavior that I'm looking for. The mouse is grabbed immediately and works, but once I move the mouse to the edge of the screen, I'm no longer able to rotate the camera.
  2. Switch mouse state

    Hi, I am experimenting with UI. Using code below I try to switch the mouse state when i press F After reading these docs and looking in the sample i have not found a solution https://developer.unigine.com/en/docs/2.12/code/usage/mouse_customization/index?rlang=cpp https://developer.unigine.com/en/docs/2.12/start/programmer/user_inputs?rlang=cs https://developer.unigine.com/en/docs/2.12/start/programmer/ui?rlang=cpp The states only seem to work the first cycle. And i do not find what I am missing. private void Update() { if (Input.IsKeyDown(WidgedMode)) { switch (ControlsApp.MouseHandle) { case Input.MOUSE_HANDLE.GRAB: Input.MouseHandle = Input.MOUSE_HANDLE.SOFT; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.SOFT; Log.Message($"MOUSE_HANDLE.GRAB -> SOFT\n"); break; case Input.MOUSE_HANDLE.SOFT: Input.MouseHandle = Input.MOUSE_HANDLE.USER; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.USER; Log.Message($"MOUSE_HANDLE.SOFT -> USER\n"); break; case Input.MOUSE_HANDLE.USER: Input.MouseHandle = Input.MOUSE_HANDLE.GRAB; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.GRAB; Log.Message($"MOUSE_HANDLE.USER -> GRAB\n"); break; default: break; } } } Admitting i do not understand this sample in the docs /// Method toggling the mouse cursor's state public void ToggleMouseCursor() { // getting current mouse state bool enabled = controls_app.MouseEnabled; // toggling movement restriction to the application window area App.SetMouseGrab(enabled ? 0 : 1); // toggling mouse interaction with GUI elements gui.MouseEnabled = enabled; // toggling mouse control controls_app.MouseEnabled = !enabled; } Unigine v2.12.0.2 Thanks for the help
  3. Hide Mouse Cursor

    Hi, I’m looking to control when the cursor graphic is displayed on screen so I can toggle between showing mouse cursor for UI interaction and hiding the mouse cursor for controlling the player camera via custom controls. Currently I and using the define MOUSE_USER and have the two functions below in an input manger class to enable mouse control which should hide the mouse cursor but still allow getting mouse delta x and y values for custom control handling while the cursor is hidden and disable mouse which should show the cursor disabling my custom input and allow the user to interact with UI: public void EnableMouse() { if(!MouseEnabled) { App.get().setMouseGrab(1); App.get().setMouseShow(0); //controls.grab(); //ControlsApp.get().setMouseEnabled(0); MouseEnabled = true; } } public void DisableMouse() { if (MouseEnabled) { App.get().setMouseGrab(0); App.get().setMouseShow(1); //ControlsApp.get().setMouseEnabled(1); //controls.release(); MouseEnabled = false; } } Currently when I call App.get.setMouseShow(0) the default windows cursor is hidden but replaced by the cursor graphic below: How can I achieve the desired results? Mouse Enable should: · Hide all cursor graphics · Allow a method of retrieving either mouse delta x and y or mouse position x and y within the my custom input manager class · Disable interaction with Unigine UI Mouse Disable should: · Show default windows cursor allowing interaction with Uninge UI
  4. Hi, I want to set it so the mouse doesn't disappear when the user clicks on the app window while not over UI. I've seen the post linked below and tried -extern_define MOUSE_SOFT but this didn't change how the cursor behaved. We are developing a VR application and the screen shows the main menu and a spectator mode but i don't want the user to be able to click and hide the mouse cursor. How would i go about controlling the cursor behaviour to achieve this?
  5. mouse grab release

    Hello What mouse related methods are called when user press ~tilda or ESC I'm tried this methods engine.gui.setMouseGrab(1); engine.controls.setMouseEnabled(0);//freeze engine.app.setMouseShow(1);//windows mouse camera.setHandled(false); camera.setEnabled(false); camera.getControls().release(); camera.setControlled(1); camera.setControls(0); tag code has infinite loading for me but with no success I need area on screen, where user click will not grab mouse and not hide cursor
  6. Hi everyone, There have a question about mouse chose precision, I have input a object(.mesh ) in the scene, and I try to chose it by mouse click, but now I have a question that the mouse click around the model but not on the model I can chose the model too. my model input by C++ as follow: my model input code: ObjectMeshStaticPtr mesh; mesh = ObjectMeshStatic::create(modelPath.c_str()); mesh->setMaterial(texture_material_0, "*"); The code about mouse chose (It's refer to the Unigine demo "Orbits"): int checkIntersection() { if (Unigine::Editor::get()->isLoaded()) return 1; if (Unigine::ControlsApp::get()->isMouseEnabled()) return 1; if (Unigine::App::get()->getMouseButtonState(Unigine::App::BUTTON_LEFT) ) { mat4 projection; float x0 = float(Unigine::App::get()->getMouseX() - 1) / Unigine::App::get()->getWidth(); float y0 = float(Unigine::App::get()->getMouseY() - 1) / Unigine::App::get()->getHeight(); float x1 = float(Unigine::App::get()->getMouseX() + 1) / Unigine::App::get()->getWidth(); float y1 = float(Unigine::App::get()->getMouseY() + 1) / Unigine::App::get()->getHeight(); getPlayerMouseSelection2(x0, y0, x1, y1, projection); PlayerPtr player = Game::get()->getPlayer(); if (Unigine::Editor::get()->getPlayer().get() != NULL) { player = Unigine::Editor::get()->getPlayer(); } //bondbox Mat4 modelview = player->getIWorldTransform(); WorldBoundFrustum bound_frustum = WorldBoundFrustum(projection, modelview); Vector< NodePtr > nodes; Unigine::World::get()->getIntersection(bound_frustum, -1, nodes); for (int i = 0; i < Models.size(); i++) { Models[i]->isSelected = false; } if (nodes.size() != 0) { ObjectMeshStaticPtr OneOfSelected; NodePtr n; for (int i = 0; i < nodes.size(); i++) { n = nodes[i]; const char *name = "ObjectMeshStatic"; if (strcmp(n.get()->getTypeName(), name) == 0) { for (int i = 0; i < Models.size(); i++) { if (n.get()->getName() == Models[i]->mesh.get()->getName()) { Models[i]->isSelected = true; } } } } } } return 0; } // calculate the projection matrix int getPlayerMouseSelection2(float x0, float y0, float x1, float y1, mat4 &projection) { PlayerPtr player = Game::get()->getPlayer(); if (Unigine::Editor::get()->getPlayer().get() != NULL) { player = Unigine::Editor::get()->getPlayer(); } int width = Unigine::App::get()->getWidth(); int height = Unigine::App::get()->getHeight(); projection = player->getProjection(); projection.m00 *= float(height) / width; vec3 points[8]; points[0] = vec3(-1.0f, -1.0f, -1.0f); points[1] = vec3(1.0f, -1.0f, -1.0f); points[2] = vec3(-1.0f, 1.0f, -1.0f); points[3] = vec3(1.0f, 1.0f, -1.0f); points[4] = vec3(-1.0f, -1.0f, 1.0f); points[5] = vec3(1.0f, -1.0f, 1.0f); points[6] = vec3(-1.0f, 1.0f, 1.0f); points[7] = vec3(1.0f, 1.0f, 1.0f); mat4 iprojection = inverse(projection); for (int i = 0; i < 8; i++) { vec4 p = iprojection * vec4(points[i]); points[i] = vec3(p) / p.w; } float dx = points[1].x - points[0].x; float dy = points[0].y - points[2].y; x0 = points[0].x + dx * x0; x1 = points[0].x + dx * x1; y0 = points[2].y + dy * y0; y1 = points[2].y + dy * y1; if (projection.m32 == 0.0f) projection = ortho(x0, x1, y0, y1, -points[0].z, -points[4].z); else projection = frustum(x0, x1, y0, y1, -points[0].z, -points[4].z); return 1; } By those codes I can chose my model but not precision, when the mouse click almost everywhere in the red circle I can chose the model but not when the mouse click on the model only I can chose the model: Do you konw how can I make the mouse chose range more precise? Thanks!
  7. So, I have a tool that I'm building to create roads both geometrically and using a project decal; the DecalDeferredMesh. The issue is that once I turn a mesh into a DecalDeferredMesh and project it onto the terrain I can no longer select it using the mouse as I can my other ObjectMeshDynamic geometry. Can anybody give me a suggestion on what I can use to use the mouse to select a DecalDeferredMesh? Thanks, Josh
×
×
  • Create New...