What is the normal rotation of objects when created? Just curious because I am messing with the following code to display a mesh logo but I’m not sure what direction is everything. So the camera viewport will show directly in front of the logo?
I also noticed .8f. What does that mean? Does it mean feet? Also, the matrix scale from Blender to Urho3D.
Is the scale 1 to 1.
How are you?
PS. So far I got the UI to show separately from the 3D render view. So, I’m not sure if both can be mixed. or do I have to do the render layer first then ui.
[quote] /// Get Needed SubSystems
ResourceCache* cache = GetSubsystem();
Renderer* renderer = GetSubsystem();
Graphics* graphics = GetSubsystem();
UI* ui = GetSubsystem();
// create a new scene
scene_= new Scene(context_);
/// Get rendering window size as floats float width = (float)graphics->GetWidth(); float height = (float)graphics->GetHeight(); SharedPtr<Sprite> backgroundimage(new Sprite(context_)); // Get the Urho3D fish texture Texture2D* decalTex = cache->GetResource<Texture2D>("Resources/Textures/login.png"); backgroundimage->SetTexture(decalTex); /// The UI root element is as big as the rendering window, set random position within it backgroundimage->SetPosition(width/2, height/2); /// Set sprite size & hotspot in its center backgroundimage->SetSize(width,height); backgroundimage->SetHotSpot(width/2, height/2); /// Add as a child of the root UI element ui->GetRoot()->AddChild(backgroundimage); Node* existencelogoNode = scene_->CreateChild("Plane"); //existencelogoNode ->SetScale(Vector3(1.0f,1.0f,1.0f)); existencelogoNode ->SetPosition(Vector3(0.0,0.0,0.0)); existencelogoNode ->SetRotation(Quaternion(180.0,90.0,0.0)); StaticModel* existencelogoObject = existencelogoNode->CreateComponent<StaticModel>(); existencelogoObject->SetModel(cache->GetResource<Model>("Resources/Models/existencelogo.mdl")); existencelogoObject->SetMaterial(cache->GetResource<Material>("Resources/Materials/existencelogo.xml"));
// Create a directional light to the world so that we can see something. The light scene node’s orientation controls the
// light direction; we will use the SetDirection() function which calculates the orientation from a forward direction vector.
// The light will use default settings (white light, no shadows)
Node* lightNode = scene_->CreateChild(“DirectionalLight”);
lightNode->SetDirection(Vector3(0.2, .8, 0.8)); // The direction vector does not need to be normalized
Light* lightObject = lightNode->CreateComponent();
// Create a scene node for the camera, which we will move around // The camera will use default settings (1000 far clip distance, 45 degrees FOV, set aspect ratio automatically) cameraNode_ = scene_->CreateChild("Camera"); cameraNode_->CreateComponent<Camera>(); // Set an initial position for the camera scene node above the plane cameraNode_->SetPosition(Vector3(2.0,-8.0,0.0)); cameraNode_->SetRotation(Quaternion(-90.0,0.0,90.0)); // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to // use, but now we just use full screen and default render path configured in the engine command line options SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>())); renderer->SetViewport(0, viewport);