Polygon Brush Help (Solved)

Topics: Developer Forum, User Forum
Aug 23, 2009 at 5:05 AM
Edited Aug 23, 2009 at 5:20 AM

Hey ive been trying to get my camera working with the poly brush and am 90% there but now although it renders fine and stuff in regards to position and camera zoom when an item rotates it rotates from the bottom left corner and not the center how can i fix that?

heres the draw code

public void Draw(Vector2 Position, float Rotation)
	{
		Matrix cameraMatrix = Matrix.Identity;
		Matrix projectionMatrix = Matrix.CreateOrthographicOffCenter(0, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height, 0, -100, 100);
		Matrix worldMatrix = Matrix.CreateRotationZ(Rotation) * Matrix.CreateTranslation(new Vector3(Position, 0)) * g_Camera.GET.transform;

		_graphicsDevice.VertexDeclaration = _vertexDeclaration;

		// set the effects matrix's
		_effect.World = worldMatrix;
		_effect.View = cameraMatrix;
		_effect.Projection = projectionMatrix;

		_effect.Alpha = _alpha;    // this effect supports a blending mode

		_effect.VertexColorEnabled = true;   // we must enable vertex coloring with this effect
		_effect.GraphicsDevice.RenderState.CullMode = CullMode.None;

		_effect.Begin();

		foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
		{
			pass.Begin();
			_graphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, _shaderVertices, 0, _triangulatedVertices.Length, _indices, 0, _indices.Length / 3);
			_graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, _lineStrip.ToArray(), 0, _triangleCount);
			pass.End();
		}

		_effect.End();
	}

If anyone has any ideas that would be great.
Is there any way to set an origin like on the spritebatch's render calls?
Aug 23, 2009 at 11:07 AM

I have fixed the problem. I just offset the position now.