namespace BP
{
	namespace WorldText
	{
		const float WORLDCHAR_SPACING = 30.0f;
		//------------------------------------------------------------------------------------------------------------------------
		// shows the text above this actor if they have a world component other wise will be displayed at the actors origin.
		//------------------------------------------------------------------------------------------------------------------------
		void Show(kActor @actor, kStr&in text, kVec3& in posOffset = Math::vecZero)
		{
			kVec3 origin = actor.Origin();
			kWorldComponent @worldComponent = actor.WorldComponent();
			if (@worldComponent != null)
			{
				posOffset.z += (worldComponent.Height() + worldComponent.HeightOffset()) * 1.2f;
			}
			
			int textLength = BP::String::Length(text);
			for (int i = 0; i < textLength; ++i)
			{
				kActor @charController = BP::Spawn::Actor(kActor_Controller_WorldChar, origin);
				DebugAssert(@charController != null, "[WorldText::Show] charController is null");
				float offset = (-((textLength - 1) / 2.0f) + i) * WORLDCHAR_SPACING;
				BP::Trigger::WorldCharSetup(@charController, @actor, text[i], origin, posOffset, offset);
			}
		}
		//------------------------------------------------------------------------------------------------------------------------
	};
}
