# Create a point in a direction In Cesiumjs

I am using CesiumJs. I would like to create point D at distance C from point A using the direction B

Point A => start Position (CartographicPosition {latitude, longitude; altitude})
Direction B => direction from A (HeadingPitchRoll {heading, pitch, roll})
Distance C => in meters

I am trying to get the rotation an object is facing, and create a point in front of him.

My current implementation is

public createROIfromRotation(position: Cartographic, rotation: HeadingPitchRoll): Cartographic {

const pos = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);
const quat = Cesium.Transforms.headingPitchRollQuaternion(pos, rotation);
const rot = CesiumMath.QuaternionToEuler(quat);

const dir = Cesium.Cartesian3.multiplyByScalar(rot, 10, new Cesium.Cartesian3());
const roiPos = Cesium.Cartesian3.add(pos, dir, new Cesium.Cartesian3());

return Cesium.Ellipsoid.WGS84.cartesianToCartographic(roiPos);
}

But it is not rotating around the object, it is doing some kind of curve in different planes.

I would like the red point to be always in front of the truck at 10 meters distance
Exemple

Entities donâ€™t expose a computed â€śforward vectorâ€ť, but you can compute this by getting the entityâ€™s orientation (as a quaternion) and multiplying that by some unit vector. CesiumJS doesnâ€™t seem to have a method to directly apply a quaternion to a vector, so youâ€™ll want to convert the quaternion to a Matrix 3 first:

// orientation is the entity.orientation
var rotationMatrix = Cesium.Matrix3.fromQuaternion(orientation);
// 10 here is the distance I want to push the point away from the origin of the vehicle

var offsetVector = new Cesium.Cartesian3(10, 0, 0);

// Apply the orientation to this vector
offsetVector = Cesium.Matrix3.multiplyByVector(rotationMatrix, offsetVector, offsetVector);

// Offset the dotâ€™s position by the computed vector

var newPosition = entity.position.getValue(viewer.clock.currentTime).clone();