ParaToxic Posted November 22, 2012 Posted November 22, 2012 Hei I have a problem in my code.I'm programming a 3D menu and have some components like Buttons,Sliders... Now I wan't to use Raycasting to get the button be selected from the mouse and soone. I load my button with LoadMesh ( not a model!) and set the Key to "MENU" with a value "BUTTON" In my Update function I have the following code: CameraPick(&_raycast,IEngineSystem::Inst()->GetCamera(),Vec3(MouseX(),MouseY(),200)); if(_raycast.entity) { if(GetEntityKey(_raycast.entity,"MENU") == "BUTTON" ) { IMenuComponent* temp = (IMenuComponent*)GetEntityUserData(_raycast.entity); temp->_state = B_SELECTED; IConsole::inst()->Debug("HI"); } } But I never get the BUTTON value of the key.I get allways a null-string..... Can you help me with that ?? Thanks Quote
Canardia Posted November 22, 2012 Posted November 22, 2012 You can't compare C strings with == operator. You can do: !strcmp("BUTTON",GetEntityKey(...)) or "BUTTON"==string(GetEntityKey(...)) . Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
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.