HUD Target/Waypoint Marker

My goal is to make a free-flying space dogfighting sim (see my other post: ‘How to Handle Collision Handling (conceptual question)’).

I need to put indicators on the HUD for targets, waypoints, etc. The indicator will be a constant size onscreen, but its position will follow the target’s location such that there is a line-of-sight from the camera through the indicator to the target. It will look like the indicator is on top of the target.

Currently, I am implementing this using an OnscreenImage, setting its position manually every frame according to values calculated from the target’s position. This works properly, and it looks fairly good, but it’s a little jittery, or laggy you might say. I assume this is due to the fact I am going through the task manager rather than including it in the scene graph.

Does anyone know a better way to implement this? I considered using billboards. They would need to be resized every frame, though, and it seems like that would cause just as much of a problem.

Thanks in advance.

There’s no reason that a task should be out of sync, or more laggy, than any other mechanism. Tasks are run synchronously with the frame render, so a task can be 100% synchronized with everything else in the scene.

You do want to make sure that your update task runs after any task that moves your camera or the thing it is following, though. All tasks run once per frame. If your update task runs first, then the object moves, then clearly your card position will be off by one frame.

To order the tasks within the frame, use task.setSort(n), or taskMgr.add(…, sort = n), where n is an integer value. Higher number sorts are run later. You probably want a value like 10, which is more than zero (the default value) but less than 50 (which is igloop, where the frame is actually rendered).


Awesome. Changing the order of the tasks worked perfectly.

Thanks a billion.