RotationMatrix
Introduction
Code Example
for (int x = 0; x < 10; x++)
{
for (int y = 0; y < 10; y++)
{
Sprite sprite = SpriteManager.AddSprite("redball.bmp");
// Default Sprites are 2x2 so we need to multiply by 2 to make
// them sit end-to-end
sprite.X = x * 2;
sprite.Y = y * 2;
}
}
// Now let's rotate the Camera on the Y axis so it looks at an angle:
// Making this number larger will make the camera more at the horizon.
// Making the number smaller will make the camera look more at the ground.
// A value of 0 is perfectly top-down. A value of Math.PI/2 (about 1.51)
// will make the camera look at the horizon.
SpriteManager.Camera.RotationX = .6f;
SpriteManager.Camera.X = 10;
// We need to move the camera down a bit so it can look up at the Sprites:
SpriteManager.Camera.Y = -5;
// Let's bring the camera "closer to the ground"
SpriteManager.Camera.Z = 20;
// If the camera is rotated, we need to turn off cull mode:
SpriteManager.Camera.CameraCullMode = CameraCullMode.None;Last updated
Was this helpful?