public Pawn(bool whitePiece, Vector3 rotation, float scale, int xB, int yB) : base(xB, yB, rotation, scale) { _type = Util.PieceType.Pawn; dt = 0.01f; dr = 0.005f; _position = getPosition(xB, yB, 1.5f * scale); yMin = _position.Y - 0.5f; yMax = _position.Y + 0.5f; _whitePiece = whitePiece; if (!whitePiece) { _side = Util.PieceSide.Black; dt = -0.02f; AngularVelocity = -0.01f; } Matrix world = Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateScale(_scale) * Matrix.CreateFromYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z) * Matrix.CreateTranslation(_position); int index = 0; if (!whitePiece) index += 6; _model = new My3DModel(_samplePieces[index], world); }
public King(bool whitePiece, ContentManager content, Vector3 rotation, float scale, int xB, int yB) : base(xB, yB, rotation, scale) { _type = Util.PieceType.King; dt = 0.005f; AngularVelocity = 0.0025f; _position = getPosition(xB, yB, 2.5f * scale); yMin = _position.Y - 0.5f; yMax = _position.Y + 0.5f; string strModelName = @"Models/king"; _whitePiece = whitePiece; if (!whitePiece) { _side = Util.PieceSide.Black; strModelName += "B"; dt = -0.005f; AngularVelocity = -0.0025f; } else strModelName += "W"; Matrix world = Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateScale(_scale) * Matrix.CreateFromYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z) * Matrix.CreateTranslation(_position); int index = 5; if (!whitePiece) index += 6; if (_samplePieces[index] == null) _samplePieces[index] = new My3DModel(strModelName, content, world); _model = new My3DModel(_samplePieces[index], world); }
public ChessPiece3D(string strModelName, ContentManager content, Vector3 position, Vector3 rotation, float scale) { _position = position; _rotation = rotation; _scale = scale; Matrix world = Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateScale(_scale) * Matrix.CreateFromYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z) * Matrix.CreateTranslation(_position); _model = new My3DModel(strModelName, content, world); yMin = position.Y - 0.5f; yMax = position.Y + 0.5f; }
public My3DModel(My3DModel sample, Matrix world) { _world = world; _model = sample._model; Dictionary<string, object> tagData = (Dictionary<string, object>)_model.Tag; if (tagData == null) { throw new InvalidOperationException( "Model.Tag is not set correctly. Make sure your model " + "was built using the custom TrianglePickingProcessor."); } vertices = (Vector3[])tagData["Vertices"]; }
public Model3D(string strModelName, ContentManager content, Matrix world, Vector3 position) { _position = position; world *= Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateTranslation(position); _model = new My3DModel(strModelName, content, world); }