Sign in to follow this  
smacker

weird problem with particles

Recommended Posts

im making a game that is using directX 9 C# and the sampleFramework that ships with DirectX. my problem is im using the first person camera and having a few problems 1st problem im just using normal CustomVertexto create my verts this code is placed in my onframemove function, then my DrawPrimitives call is placed in my rendering loop. my fps are way to low around and I cant seem to get the math right to put the particles in front of the camera, here is the code
//this is to create the verts
CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vb.Lock(0,0);
			for(int i = 0; i<number;i++)
			{
				float x = (start.camera2.LookAtPoint.X - start.camera2.EyeLocation.X) +- (Convert.ToSingle(random.NextDouble()));
				float y = (start.camera2.LookAtPoint.Y - start.camera2.EyeLocation.Y) +- (Convert.ToSingle(random.NextDouble()));
				float z = (start.camera2.LookAtPoint.X - start.camera2.EyeLocation.Z) +- (Convert.ToSingle(random.NextDouble()));
				verts[i].X = x;
				verts[i].Y = y;
				verts[i].Z = z;
				verts[i].Color = System.Drawing.Color.Red.ToArgb();
				}
			vb.Unlock();

//this is to draw
                        device.RenderState.PointSize = size;
			device.RenderState.ZBufferEnable = true;
			device.SetStreamSource(0, vb, 0);
			device.VertexFormat = CustomVertex.PositionColored.Format;
			device.DrawPrimitives(PrimitiveType.PointList, 0, number);

problem 2 when the player shoots a object(a mesh) by pressing the mouse key the particles dissapear and then follow the object until the object is removed from the screen any help would be great EDIT: changed 'code' tags to 'source' so they dont break the forum layout, and corrected typo in subject line... [Edited by - jollyjeffers on May 1, 2006 9:32:14 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this