i wanne rotate a model based on it position on the terrain. Therefore i need four Vector3 values containing the most Bottom-Left-Rear, Bottom-Right-Rear, Bottom-Right-Front and Bottom-Left-Front vertices of my model. So i have 4 corners of my model and wanne get the height of the terrain at this points, then i wanne calc the models rotation along X and Z axis based on that using "Pythagorean".
Therefore i need to figure out this 4 vertex positions. I couldn't find a way to iterate thought an existing model object, so i looked at an inhered content processor for my models. I just wanted to customize ModelProcessor a bit, like that:

class ExtendedModelProcessor : ModelProcessor
public override ModelContent Process(
NodeContent input, ContentProcessorContext context)
MeshContent mesh = (MeshContent)input;
// blr = Bottom-Left-Rear, brf = Bottom-Right-Front, trr = Top-Right-Rear, etc.
Vector3 blr, brr, brf, blf, tlr, trr, trf, tlf;
blr = brr = brf = blf = tlr = trr = trf = tlf = mesh.Positions[0];

foreach(Vector3 pos in mesh.Positions)
if (pos.X < blr.X || pos.X < blf.X || pos.X < tlr.X || pos.X < tlf.X)
blr.X = blf.X = tlr.X = tlf.X = pos.X;
else if (pos.X > brr.X || pos.X > brf.X || pos.X > trr.X || pos.X > trf.X)
brr.X = brf.X = trr.X = trf.X = pos.X;
if (pos.Y < blr.Y || pos.Y < brr.Y || pos.Y < brf.Y || pos.Y < blf.Y)
blr.Y = brr.Y = brf.Y = blf.Y = pos.Y;
else if (pos.Y > tlr.Y || pos.Y > trr.Y || pos.Y > trf.Y || pos.Y > tlf.Y)
tlr.Y = trr.Y = trf.Y = tlf.Y = pos.Y;
if (pos.Z < blr.Z || pos.Z < brr.Z || pos.Z < tlr.Z || pos.Z < trr.Z)
blr.Z = brr.Z = tlr.Z = trr.Z = pos.Z;
else if (pos.Z > blf.Z || pos.Z > brf.Z || pos.Z > tlf.Z || pos.Z > trf.Z)
blf.Z = brf.Z = tlf.Z = trf.Z = pos.Z;

return base.Process(input, context);

Ok so now I should have my values but i don't have an idea how/where to store them to be able to use them at runtime, do i need to write a completely new model class for that ! Hopefully not

Thanks so far, Thunder2002

Re: XNA Framework How to store additional information using an inhired content processor

Shawn Hargreaves - MSFT

The easiest way would be to store your custom data (perhaps as an array of Vector3) in the Tag property of the ModelContent that gets returned from the base.Process call. That will automatically be serialized into the XNB file, and then you can access the data by looking up the Tag property from the Model you get back when you load this at runtime.