Archive 17/01/2023.

Using decal for character selection marker

rogerdv

I want to use an RTS like marker for selected entities in my game. In the Entity constructor I have this:

[code]Entity(Scene@ scn, String id)
{
node = scn.CreateChild(id);
model = node.CreateComponent(“AnimatedModel”);
decal = node.CreateComponent(“DecalSet”);
decal.material = cache.GetResource(“Material”, “Materials/SelectDecalAlpha.xml”);
animCtrl = node.CreateComponent(“AnimationController”);

}[/code]

And this is the called function when entity is clicked:

void Select() { decal.AddDecal(model, node.position, Quaternion(0.0f,90.0f,0.0f), 0.5f, 1.0f, 1.0f, Vector2(0.0f, 0.0f), Vector2(1.0f, 1.0f)); }

The problem is that I cant find the correct rotation for the decal, it is painted in the legs of the model (Im using Jack), and of cource, I want it on the floor. Tried many angle combinations in Quaternion(), but none worked. how can I do this?

codingmonkey

mb something like that: DecalNode -> SetWorldRotation ( ParentObjectNode->GetWorldRotation() ) ?

Or you may create model prefabs (or dynamic add) child node with plane mesh with ring texture (alpha test tech).
And then you select your unit you just enable ring-child node.

rogerdv

Negative. Still painted in the legs.