Home / Guides / Waypoint and Objective Markers in Unreal Engine: Screen Projection and Edge Clamping

Waypoint and Objective Markers in Unreal Engine: Screen Projection and Edge Clamping

A marker that points at a goal sounds simple, but it has three awkward cases: the target is behind you, off screen, or very close. Here is how to handle each one cleanly.

1. Project the world location to the screen

Use the player controller's Project World Location to Screen (or its widget-position variant, so the result matches the UI scale). It returns whether the point could be projected and the 2D position to place the widget at.

2. Targets behind the camera

A point behind you can still return a position that looks valid, and the marker then points the wrong way. Compare the camera's forward vector with the direction to the target (a dot product). If it is negative, mirror the position to the opposite edge, or pin the marker to the screen edge on that side.

3. Clamp to the screen edge

When the marker is outside the viewport, clamp its position to a margin inside the screen, and rotate a small arrow so it points toward the target. Keep the margin large enough to stay clear of the safe area on consoles and TVs.

4. Show distance, and fade when close

Display the distance in a readable unit and update it a few times per second, not every frame. When the player is within the arrival radius, hide or shrink the marker so it does not cover the goal.

5. Keep markers out of gameplay code

A marker is a small actor component or an object registered with a marker manager. The manager owns a single HUD layer and creates, pools and removes marker widgets. The quest, objective or pickup only says "I am a marker, here is my icon and label".

6. Limit what is on screen

Too many markers become noise. Cap the number shown, prioritise the tracked objective, and use different icons or colours for categories so players can tell them apart at a glance. Do not rely on colour alone for accessibility.

7. A compass as an alternative

If many points of interest exist, a horizontal compass bar can be cleaner than world markers. It uses the same direction maths: the angle between the camera yaw and the direction to each target.

Common mistakes

Want a working base?

If you want to skip the maths, check the related products below and read each listing for what it supports.

Related products

Tools that apply this

Need this built for your project?

I take on custom Unreal Engine, Unity and Blender work.

Request custom work