I am trying to create a Radar/Minimap for the F1 2021 game in C#/WPF. Here is a image of what I am trying to replicate


In the image, the white car (my car) will always face the direction it is going. The blue car (other play car) will face relative to my direction.

I am given the following information

public float m_worldPositionX;           // World space X position
public float m_worldPositionY;           // World space Y position
public float m_worldPositionZ;           // World space Z position
public float m_worldVelocityX;           // Velocity in world space X
public float m_worldVelocityY;           // Velocity in world space Y
public float m_worldVelocityZ;           // Velocity in world space Z
public short m_worldForwardDirX;         // World space forward X direction (normalised)
public short m_worldForwardDirY;         // World space forward Y direction (normalised)
public short m_worldForwardDirZ;         // World space forward Z direction (normalised)
public short m_worldRightDirX;           // World space right X direction (normalised)
public short m_worldRightDirY;           // World space right Y direction (normalised)
public short m_worldRightDirZ;           // World space right Z direction (normalised)
public float m_gForceLateral;            // Lateral G-Force component
public float m_gForceLongitudinal;       // Longitudinal G-Force component
public float m_gForceVertical;           // Vertical G-Force component
public float m_yaw;                      // Yaw angle in radians
public float m_pitch;                    // Pitch angle in radians
public float m_roll;                     // Roll angle in radians

I am having trouble understanding the concept of worldForwardDir and worldRightDir, and how they differ.

Furthermore, I am wondering if it is even possible at all given the information above that I can transform the worldPosition coordinates into something usable by a 2D canvas.

  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Evorlor
    Jan 14, 2022 at 16:48

2 Answers 2


Figured out the solution. Based off of Elliot's answer from this post How do I convert from the global coordinate space to a local space?

var deltaX = Car.m_worldPositionX - PlayerCar.m_worldPositionX;
var deltaZ = Car.m_worldPositionZ - PlayerCar.m_worldPositionZ;
double deltaYaw = Car.m_yaw - PlayerCar.m_yaw;

var radius = Math.Sqrt(deltaX * deltaX + deltaZ * deltaZ);
var phi1 = Math.Atan2(deltaZ, deltaX);
var phi2 = -PlayerCar.m_yaw;

var deltaPhi = phi1 - phi2;

var X = -(radius * Math.Cos(deltaPhi));
var Y = -(radius * Math.Sin(deltaPhi));

My guess would be that m_worldForwardDirX/Y/Z is a unit vector pointing forward from the white car in world coordinates, and m_worldRightDirX/Y/Z is a unit vector pointing right.

If you take the position of the blue car and subtract the position of the white car, you have a difference vector in world coordinates. If you project this vector on m_worldRightDir you get the relative x coordinate of the blue car, and if you project it on m_worldForwardDir you get the y coordinate. These x and y coordinates are the x and y of the blue car in your radar view.

Projecting a vector on another vector is done by taking the dot product of the two vectors.

  • \$\begingroup\$ Thanks for your answer anyway! I actually solved it without using the worldForwardDirX/Y/Z. Although I'm sure there are 100 ways of solving the problem \$\endgroup\$
    – Ryan
    Jan 14, 2022 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .