# move 3D entity in a direction defined by an angle

Hello,

I'm new using Cesium and what I want to do is to draw a cone pointing in a certain direction and shift the cone so that one of the edges connect to a pole.

I have managed to draw the cone in the desired location, but I can't find a way to offset the cone to make the tip connect to a pole on the original coordinate.

What I need to do is to offset an object by half his size in a specific angle.

Here is the code I have so far. This function puts the cone pointing in the direction I want but it doesn't move where I want it:

create3DNetwork = function (networkItem) {

var solidLength = 2.0;
var position = networkItem._position._value;
var shift_x = -Math.sin(Cesium.Math.PI - azimuthRadians) * solidLength;
var shift_y = -Math.cos(Cesium.Math.PI - azimuthRadians) * solidLength;

//Transform a point
var transformationMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position);
var offset = new Cesium.Cartesian3(shift_x, shift_y, 0);
var finalPos = Cesium.Matrix4.multiplyByPoint(transformationMatrix, offset, new Cesium.Cartesian3());

var pitch = 0.0;
var roll = Cesium.Math.PI_OVER_TWO - Cesium.Math.toRadians(networkItem.properties.TILT);
position: finalPos,
orientation: orientation,
cylinder: {
length: solidLength * 2,
//slices: 4, //Add this parameter if you want to change the shape of the cilinder (e.g. to a pyramid)
material: Cesium.Color.fromCssColorString("#7A0304").withAlpha(0.5) //RBG: 122,3,4
}
});
}

Thank you so much
Migue Dias

I found a solution. I'm not sure it is the best one using Cesium functionalities, but it works.

I created this function to shift the point of insertion of the cone:

// shift a coordinate from a point to a certain distance and direction
\$scope.shiftPoint = function (startPoint, bearing, distance, earthRadius) {

var verticalAngle = distance / earthRadius;
var endLatitude = Math.asin(Math.sin(startPoint.latitude) * Math.cos(verticalAngle) +
Math.cos(startPoint.latitude) * Math.sin(verticalAngle) * Math.cos(bearing));
var endLongitude = startPoint.longitude + Math.atan2(Math.sin(bearing) * Math.sin(verticalAngle) * Math.cos(startPoint.latitude),
Math.cos(verticalAngle) - Math.sin(startPoint.latitude) * Math.sin(endLatitude));