Archive 17/01/2023.

[SOLVED] Text3D in 2d scene

xotonic

I am trying to draw text over sprite.
Code:

   SharedPtr<Node> spriteNode(scene_->CreateChild("StaticSprite2D"));
	spriteNode->SetPosition2D(Vector2(0.0f, 0.0f));

	StaticSprite2D* staticSprite = spriteNode->CreateComponent<StaticSprite2D>();
	staticSprite->SetBlendMode(BLEND_ALPHA);
	staticSprite->SetLayer(1);
	staticSprite->SetSprite(sprite);

	Node* textNode = spriteNode->CreateChild();
	textNode->SetPosition2D(Vector2(0.f, 0.f));
	Text3D* titleText = textNode->CreateComponent<Text3D>();
	titleText->SetText("name");
	titleText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
	titleText->SetColor(Color::WHITE);

But nothing happens. I tryed set face camera mode (with all params), text not drawing.
How to set text in 2d scene correctly?

UPD: I moved node along Z axis.

textNode->SetPosition(Vector3(0.f, 0.f, -0.1f));

Now text dissappears after camera move :

xotonic

I`m stupid. I forgot SetOrthographic(true) :smiley:

Now it`s ok.