This project has moved and is read-only. For the latest updates, please go here.

Polygon Brush Help (Solved)

Topics: Developer Forum, User Forum
Aug 23, 2009 at 6:05 AM
Edited Aug 23, 2009 at 6: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;


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


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 12:07 PM

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