Vida Marcell Posted May 15, 2022 Share Posted May 15, 2022 //Values Vec2 mouseRot; while (true) { if (mainwindow->Closed() or mainwindow->KeyDown(UltraEngine::KEY_ESCAPE)) break; mouseRot = Vec2(mainwindow->GetMousePosition().x * -1 / 1.71, mainwindow->GetMousePosition().y * -1 / 1.71); if (window->MouseDown(3)) { model->SetRotation(0, mouseRot[0], mouseRot[1]); } I can rotate the model but it does'nt recognize any mouse button interactions. Quote Link to comment Share on other sites More sharing options...
reepblue Posted May 15, 2022 Share Posted May 15, 2022 Wouldn't this be easier with events? 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Vida Marcell Posted May 15, 2022 Author Share Posted May 15, 2022 Its too complicated, i want to do it whit an if statement Quote Link to comment Share on other sites More sharing options...
reepblue Posted May 15, 2022 Share Posted May 15, 2022 Haven't really played with UAK in a while. Verify the mouse hit if statement is actually turning true with a breakpoint or a print out., also I don't recall being able to get the values of the Vec2 class like if it was an array. Try using this instead. model->SetRotation(0, mouseRot.x, mouseRot.y); Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Vida Marcell Posted May 16, 2022 Author Share Posted May 16, 2022 The rotation is wokring, i just cant limit it, whit the left mouse button. Quote Link to comment Share on other sites More sharing options...
Vida Marcell Posted May 16, 2022 Author Share Posted May 16, 2022 So this is my* code, vs can compile it, but i cant interact with any of my keyboard and mouse buttons while (true) { if (mainwindow->Closed() or mainwindow->KeyDown(UltraEngine::KEY_ESCAPE)) break; mousedown = false; if (window->MouseDown(1)) { m_vCamRot.y += (window->MouseX() - (window->GetWidth() / 2)) * Time::GetSpeed() * 0.2; m_vCamRot.x += (window->MouseY() - (window->GetHeight() / 2)) * Time::GetSpeed() * 0.2; mousedown = true; } m_vCamRot.z = -3 + window->GetMousePosition().z; if (mousedown) { window->HideMouse(); window->SetMousePosition(window->GetWidth() / 2, window->GetHeight() / 2); } else { window->ShowMouse(); } Vec3 pos = m_pCamPivot->GetPosition(); camera->SetPosition(pos.x, pos.y + 0.5, pos.z); camera->SetRotation(m_vCamRot.x, m_vCamRot.y, 0); camera->Move(0, 0, m_vCamRot.z); This still uses uak and leadwerks. *Most of the code is from reepblue! Quote Link to comment Share on other sites More sharing options...
Josh Posted May 16, 2022 Share Posted May 16, 2022 UAK does not have control over the window. Leadwerks does. So you would use the Leadwerks commands for the mouse and keyboard input. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Vida Marcell Posted May 16, 2022 Author Share Posted May 16, 2022 Thats what i'm doing Quote Link to comment Share on other sites More sharing options...
reepblue Posted May 16, 2022 Share Posted May 16, 2022 I have code somewhere that does exactly what you want it to do. I'll need to find it first. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.