Search the Community
Showing results for tags 'position'.
-
Я начинающий в этом движке и не как ни могу понять как узнать позицию обьекта в пространстве, всю документацию пересмотрел и так и не понял как это сделать. Может я просто не могу найти тот класс который мне нужен? using System; using System.Collections; using System.Collections.Generic; using Unigine; [Component(PropertyGuid = "5ff39bf967441504a8a79c93dfaf78d64f635a3d")] public class Test : Component { private void Update() { Node node = World.GetNodeByName("Cuboid"); float worldPos = (float)node.GetWorldDirection(MathLib.AXIS.X); if (Input.IsKeyUp(Input.KEY.E)) { float TransformX = worldPos + 1.0f; Log.Message("Глобальная позиция:" + worldPos + "\n"); Log.Message("Координаты оси X:" + TransformX +"\n"); node.WorldTranslate(TransformX, 0.0f, 0.0f); } } }
- 2 replies
-
- documentation
- how to?
-
(and 8 more)
Tagged with:
-
[SOLVED] how can update the camera frist position(vec3) in unigine resource code.
yuwen.xiang posted a topic in UnigineScript
I did it in a function for updating the camera position. function code: bool Globe::setPosition(vec3& v3) { Player* player = engine.editor->getPlayer(); Mat4 transform = player->getWorldTransform(); transform.setColumn3(3,v3); player->setWorldTransform(transform); return true; } the function is do.and return position is ok.but do this code .the camera postion is vec3(0,0,0). Unigine::Engine *engine_new = Unigine::Engine::init(UNIGINE_VERSION,argc,argv); setPosition(v3); while(engine_new->isDone() == 0) { //here position is ok. engine_new->update(); //here position is return (0,0,0);why? engine_new->render(); engine_new->swap(); } why can set the camera frist position in uniginescript init() function.but i can not set in unigine resource code. PlayerSpectator player = new PlayerSpectator(); player.setPosition(vec3(-3.5,0.0,1.3)); where code update ??? -
hi, I want to know if it's possible to have the screen position of an widget. I try getPosition but if i don't set before the position i 0x0 I try with the parent of parent of parent position but doesn't work two. An example : WidgetHBox hbox; WidgetVBox vbox; WidgetSprite sprite; WidgetButton button; WidgetButton button2; /* */ int init() { Gui gui = engine.getGui(); hbox = new WidgetHBox(gui); vbox = new WidgetVBox(gui); sprite = new WidgetSprite(gui,""); sprite.setWidth(200); sprite.setHeight(200); button = new WidgetButton(gui,"B1"); button2 = new WidgetButton(gui,"B2"); gui.addChild(hbox,GUI_ALIGN_CENTER); hbox.addChild(sprite,GUI_ALIGN_BACKGROUND); hbox.addChild(vbox,GUI_ALIGN_OVERLAP); vbox.addChild(button,GUI_ALIGN_OVERLAP|GUI_ALIGN_LEFT); vbox.addChild(button2,GUI_ALIGN_OVERLAP|GUI_ALIGN_RIGHT); return 1; } /* */ int shutdown() { log.message("SHUTDOWN\n"); return 1; } /* */ int update() { counter++; if (counter == 1){ hbox.arrange(); log.message("hbox : %d x %d\n",hbox.getPositionX(),hbox.getPositionY()); log.message("sprite : %d x %d\n",sprite.getPositionX(),sprite.getPositionY()); log.message("vbox : %d x %d\n",vbox.getPositionX(),vbox.getPositionY()); log.message("Button : %d x %d\n",button.getPositionX(),button.getPositionY()); log.message("Button2 : %d x %d\n",button2.getPositionX(),button2.getPositionY()); } return 1; } if someone have an idea.