joseph.howell Posted May 28, 2016 Share Posted May 28, 2016 Hi, I've added a few console commands. But the only one that works is the one with no arguments. The console commands I've added with arguments don't work. Could you help me figure out what I've done wrong? Here's a callback: class SetCameraTargetCallback : public CallbackBase3<double, double, double> { void run (double x, double y, double z) { Log::message("Testing...\n"); PlayerSpectatorPtr player = PlayerSpectator::create(Game::get()->getPlayer()); Vec3 camPos(x,y,z); player->setNodeWorldPosition(camPos); } } SetCameraPosCallback setCameraPosCallback; And then in my code just after I initialize the engine: Console::get()->addCommand("set_camera_pos", "Sets the camera position", &setCameraPosCallback); Then once in game, opening the console window and using the ls command will list my new commands, but executing them does nothing. Unigine~# set_camera_pos 100 100 100 It doesn't print out "Hello", doesn't move the camera, nothing. But then if I call the show_nodes command I added, it works just as expected. Thanks Link to comment
silent Posted May 28, 2016 Share Posted May 28, 2016 Hi Joseph, Not sure what you want to get as a final result, but maybe this forum post will be helpful in your case? If you want to add console command with different parameters overload it's the only correct way. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
joseph.howell Posted May 31, 2016 Author Share Posted May 31, 2016 Hi Silent, Specifically, I want to have a console command for setting the camera target, position and fov. The current command sets position and euler angles, which is fine but doesn't fit our needs. We specifically want to be able to set the camera using a target. Anyways, thanks, I read the post and I'll try that out. Link to comment
Recommended Posts