Search the Community
Showing results for tags 'callback'.
-
As shown in the figure above,I add callback for my button in xml ui file.But How do I add a callback event in C#? It would be wrong to write it this way.
-
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
-
Hi, I have a variable a = 0. It is changed to 5 in a callback function. But onUpdate function I get 0 not 5. How can I access new value? int a = 0 Body right_holder_body; right_holder_body.setContactCallback(functionid(onColl)); void onColl() { a = 5; log.message("%d",a); // Output: 5 } void onUpdate() { log.message("%d",a); // Output: 0 } Thanks.
-
In my previous posts I talked about rendering single pixel lines in 3D space. I need to detect clicking on those lines. The trouble is, renderline3d doesn't create a node in the scene to interact with. My first idea was to create an invisible capsule node underneath each 3D line and detect click events on this capsule. I have used the example code outlined here: https://developer.unigine.com/en/docs/1.0/scripting/library/class.gameintersection Trouble is, even setting up all of the collision masks, I can't seem to get a click to register on the capsule. Is this the "best" way to detect clicks on one pixel poly lines? Is there a better way that doesn't involve creating and manipulating underlying dummy nodes? Thank you, Andrew
-
Hello. I have two ObjectGui on the scene. Both of them have WidgetSprite with callbacks: GUI_ENTER, GUI_LEAVE, GUI_PRESSED and GUI_RELEASED. So the problem: callbacks are firing when they should not. Sometimes when i click on one sprite, i see click on both sprites. Sometimes i just click somewhere in the world and one of sprites become clicked too. It is clearly seen in attached simple demo. I expect sprites to work like independent buttons with 3 states (normal, mouse over, pressed). sprite_callbacks.rar
- 1 reply
-
- WidgetSprite
- ObjectGui
-
(and 2 more)
Tagged with:
-
Problem Strange system behavior when an objectgui widget is clicked. It causes wrong intersection operations and player control failure. Reproduction steps It's not automatic but easy to reproduce (just repeat steps 3-4 until it happens): Place attached zip content in data/samples folder. Execute guiproblem world Click on any of the labels (an engine message is shown "s:label 1" or "s:label 2") Click over the box and the label callback is invoked again. Once this happens, you can click the background and the callback will be invoked again. In addition you wouldn't be able to control player. Thanks in advance. teacherview.zip
-
A bug with the order of events on the stack for GUI ... Gui gui = engine.getGui(); WidgetButton btn1 = new WidgetButton(gui, "Button 1"); btn1.setCallback( GUI_ENTER, "onEnter", 1 ); btn1.setCallback( GUI_LEAVE, "onLeave", 1 ); gui.addChild(btn1); WidgetButton btn2 = new WidgetButton(gui, "Button 2"); btn2.setCallback( GUI_ENTER, "onEnter", 2 ); btn2.setCallback( GUI_LEAVE, "onLeave", 2 ); gui.addChild(btn2); ... void onEnter( int id ) { log.message("onEnter( 'Button %d' )\n", id); } void onLeave( int id ) { log.message("onLeave( 'Button %d' )\n", id); } Please see the result in the attached picture. OrderEvent.rar
-
Hi. How do I file a interfeys.ui the call callback to set more than one parameter? Example: // inventory.ui <button> <text>Buy</text> <callback type="clicked" string="abc" string="50">Game::buy</callback> </button> // game.h void buy (string name, string cost) { // } Thank.
-
[SOLVED] Unigine Script Callbacks from external C++ script
mandee.cabato.ph posted a topic in C++ Programming
Hi, I've managed to make a plugin that is loaded successfully by the game. Right now, I'm trying to call a function in the world script via the plugin. I can't figure out how to make the sample in the documentation work. I tried inserting the provided code into my plugin script, but it does not seem to load correctly. I suppose it's because main(int argc,char **argv) is not called. I would have attempted to call aforementioned function in the definition of my plugin init but I do not know what parameters to provide. Any help on the matter would be appreciated. -
WorldClutter and WorldCluster node creation and deletion callback
david.broto posted a topic in Feedback for UNIGINE team
Related to this post https://developer.unigine.com/forum/topic/1068-acessing-individual-clutter-generated-nodes/ it would be awesome to have some callback system at WorldClutter and WorldCluster classes at every creation/deletion of dynamic nodes (or batch of nodes). This could make these classes more powerful and dynamic. Thanks!- 3 replies
-
- worldclutter
- callback
-
(and 1 more)
Tagged with: