Jump to content
  • Advertisement
Sign in to follow this  
smacker

weird problem with particles

This topic is 4436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.X = x;
				verts.Y = y;
				verts.Z = z;
				verts.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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!