The model primitive can load and render COLLADA and AGI's MDL models. COLLADA is an industry standard, XML-based 3D model format. MDL is the 3D model format used by STK. We recommend using COLLADA models, although they consume slightly more disk space since they are XML-based. Model's can be downloaded from AGI's website
Model's can be initialized as shown in the Initialization section:
IAgGxCentralBody earth = sceneManager.CentralBodies("Earth"); IAgGxPrimitiveModel model = new AgGxPrimitiveModel(); model.InitializeCartographic(earth, "file:///./Data/Models/hellfire.dae", Trig.DegreesToRadians(39.88), Trig.DegreesToRadians(-75.25), 5000);
The orientation of the model depends on the model itself. For example, in the hellfire.dae model, the missile is laid out lengthwise along the positive x axis. To change the orientation, use the SetOrientationQuaternion method and provide a quaternion that defines the rotation from the model's local axes to the axes of the reference frame in which the model's position is defined. In this case, the model's position is defined in the central body's fixed frame since InitializeCartographic was used. A convenient way to compute the quaternion is to use DGL:
EarthCentralBody earth = CentralBodiesFacet.GetFromContext().Earth; Cartographic center = new Cartographic(Trig.DegreesToRadians(-75.25), Trig.DegreesToRadians(39.88), 0); PointCartographic origin = new PointCartographic(earth, center); Axes axes = new AxesNorthEastDown(earth, origin); AxesEvaluator axesEvl = GeometryTransformer.GetAxesTransformation(axes, earth.FixedFrame.Axes); Quaternion q = axesEvl.Evaluate(TimeConstants.J2000); ElementaryRotation r = new ElementaryRotation(AxisIndicator.Second, Math.PI / 2); q = q.Multiply(r); model.SetOrientationQuaternion(q.W, q.X, q.Y, q.Z);
A topographic axes is created based on the model's position where the x axis point in the local north direction, the y axis points in the local east direction and the z axis points in the local down direction. A quaternion that defines the rotation from these axes to the fixed frame axes is created. To point the model in the local up direction, the quaternion is rotated 90 degrees around the y axis.
Like orientation, the size of the model depends on the model itself. To change the size of the model, use the ExponentialScale property. After a model is initialized, its position can be changed with SetPosition or SetPositionCartographic.
COLLADA models also support dynamic images. See the Dynamic Images on Models overview for more information.