Display Orientation Body Vectors as Vectors

I have been searching around all morning trying to determine how to display an Entity’s body axes as vectors in Cesium. I have the body vectors defined in global coordinates, and it seems that it should be relatively easy to just draw a line from the entity’s position in the direction of each of the three body vectors, with some length. However, I don’t see a straightforward way to do that. I have looked around in Sandcastle and searched these forums, and I don’t know the best path forward.

I see the concept of “Vector” in this CZML documentation, but it also says it is a plugin, and I don’t see any reference to something like this in the Entity API documentation:

I also looked into cylinder objects with a cone at the end (to make an arrow), but that doesn’t seem to be a very efficient way to do this.

My entities are satellites, and they have sampled position properties which represent their orbit data over time, but I’d only like to show the body axes at “time now”. This is essentially what I’m trying to create:


Would love to specify these in CZML also, if possible.


For anyone who stumbles across this in the future, I managed to sort it out.

CesiumJS has a “DebugModelMatrixPrimitive” which isn’t meant for production use, but does exactly what I’m looking for.

The following code computes an entity’s modelMatrix, which is a 4x4 matrix representing an entity’s position and orientation, then sets that modelMatrix as the DebugModelMatrixPrimitive:

        var att_mat4 = this_entity.computeModelMatrix(viewer.clock.currentTime);
        var this_model_map_prim = new Cesium.DebugModelMatrixPrimitive({
            modelMatrix : att_mat4,
            length : 10000,
            width : 5.0

Note, however, that this only computes the modelMatrix at the current time. If you want this to animate then you’ll have to attach an event listener (I used postUpdate), which gets the new modelMatrix at the current time and sets that as the modelMatrix attribute of the primitive.

I did something like this (pseudo-code ish):


function update_model_matrix(scene, time) {
      var this_att = this_entity.computeModelMatrix(time);
      this_prim.modelMatrix = this_att;

Using the “simple.czml” from the Cesium examples, I am able to display an updating set of body axes as the timeline animates:

Note: The above code isn’t everything needed to make this work, but should get you pretty far toward implementing this.