Jump to content

[SOLVED] How to draw the "flight path" of an entity?


photo

Recommended Posts

Hello,

For a flight replay/analysis, we need to draw the flight path of an entity, like this:

 flight_path.png.4b4e6931ec84a0fa03d5de77eb3a73b2.png

The entity would most likely be sent via CIGI, but DIS is also a possibility. The behavior of the trace is to leave a trail behind the entity for a certain amount of time and draw vertical lines every n'th second.

At this point, I don't know if the better way would be to create a dynamic mesh, or to instantiate a multitude of small nodes, or something different entirely. Worse, I'm not sure how I should go for attaching this "drawing" behavior to an entity?

Any thought? Thanks!

 

Link to comment

Hello Stephane,

The best way to do this is drawing Dynamic Mesh. It's a low-level approach but it will give you better results. Spawning nodes looks like a bad idea — you'll need a lot of them on a big distances, this will drop performance down.

With Dynamic mesh you can draw a path and build a perpendicular line that falls down to the terrain. One thing should be considered — mesh size. Object Mesh Dynamic uses float vertex coordinates (vec3) that means you're limited in the object size. I suggest checking bound box, if you approaching to 10km — it's time to create another mesh.

As for the timer logic it can be done in AppWorldLogic.cpp, something like that:

update() 
{
if (Game::get()->getTime() - time > 1.0f)
{
IG::getEntity() 
time = Game::get()->getTime();
}
}

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

I see how to do the dynamic mesh, but if I want the lines to have a constant width on screen, independent from their distance, I might need to have them scaled in the shader. I see there is a Geometry Inflation state in the default mesh material, but it doesn't scale with the distance. Would you have a sample to help me do this? Also, I thought about using the Visualizer but it doesn't look like it can do thick lines and antialiasing.

Link to comment
16 hours ago, Amerio.Stephane said:

Geometry Inflation state in the default mesh material, but it doesn't scale with the distance

That what it does. I think geometry inflation should work fine for your case. On the attached image you can see a cylinder 1 meter in diameter from 10km view. Geometry inflation is set to Wire, Vertex Ballon = 1.

image.png

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • morbid changed the title to [SOLVED] How to draw the "flight path" of an entity?

Just a minor remark: I changed the material to be additive and have Emission, with a high Intensity and enabled the glow effect (trying to simulate a 'ghostly' effect). But the glow effect depends on the distance, not on the visible width of the cylinder, so it is very strong near the cylinder and completely invisible far away yet the width on screen is the same (vertex balloon set to 10 for testing).

Edited by Amerio.Stephane
Link to comment
×
×
  • Create New...