flying in 3D

Started by
4 comments, last by smacker 18 years, 1 month ago
I having a bit of a problem, I have a client and server, on the client Im using a first person camera when you move on the client the client sends the EyeLocation as the players x, y, z and the LookAtPoint as the players yaw, pitch, roll to the server, these 6 cords are then sent to every connected client. when 2 clients are connected you can see the other client but the movment is a mess, if the other client is coming at you the ship flips around, how do I go about fixing this to make the ships fly right?
Advertisement
hi,

I think you'll get the answer to your question more easily, if you move it to the Multiplayer and Network Programming forum.

by the way: are you sure all players use the same (eg. global) coordinate system when they send data to the server?

kp
------------------------------------------------------------Neo, the Matrix should be 16-byte aligned for better performance!
I was going to put it there but its not really a networking problem my udp read/send works great, here is my transform world matrix im using

dev.Transform.World = Matrix.Transformation(new Vector3(0,0,0), Quaternion.Identity, new Vector3(.3f, .3f, .3f), new Vector3(px, py,pz), Quaternion.RotationYawPitchRoll(pyaw, ppitch, proll), new Vector3(px, py, pz));

this is the camera view matrix

dev.Transform.View = Matrix.LookAtLH(camera2.EyeLocation, camera2.LookAtPoint, new Vector3( 0.0f, 1.0f, 0.0f ));

and last but not least the projection matrix

dev.Transform.Projection = Matrix.PerspectiveFovLH((float)(Math.PI / 4), Framework.DefaultSizeWidth / Framework.DefaultSizeHeight, 1.0F, 1000.0F);

the data sent is
camera2.EyeLocation.X ect...(this is used as the x,y,z
camera2.LookAtPoint.X ect...(this is used as the yaw,pitch,roll)<--I belive this is my problem
First of all you should check if your coordinates are correctly transmitted in the
client-sever-client cycle.

Secondly you should double check the interpretation your client has for incoming data. Try playing a bit with those values.

It would be good ideia to post here your client's interpretation of incoming coordinates.

My project`s facebook page is “DreamLand Page”

I think it might have to do with the rotation center


dev.Transform.World = Matrix.Transformation(new Vector3(0,0,0), Quaternion.Identity, new Vector3(.3f, .3f, .3f), new Vector3(px, py,pz), Quaternion.RotationYawPitchRoll(pyaw, ppitch, proll), new Vector3(px, py, pz));

what would I want my rotation center to be?

EDIT: its not that I reset it to Vector3().

[Edited by - smacker on March 14, 2006 9:17:16 AM]
this is a packet

UDP SEND TO SERVER 001|0|0|-23.09038|0|0|-22.09038

UDP READ FROM SERVER 0004|0|0|-23.09038|0|0|-22.09038|Smoke

maybe I should explain this

the first packet

001, packet number
0 = x, x = camera.EyeLocation.X
0 = y, y = camera.EyeLocation.Y
-23 = z, z = camera.EyeLocation.Z
0 = x, x = camera.LookAtPoint.X
0 = y, y = camera.LookAtPoint.Y
-22 = z, z = camera.LookAtPoint.Z---hmmm...might be a problem

this packet is sent to the server the sent to all connected clients the packet is read like the sec packet on each client
this is how the data is prossesed
the first x,y,z go into the translation to give the x,y,z position in space
the sec x,y,z go into the Quaternion.RotationYawPitchRoll(x, y, z)
I did set the roll to a default 0.0f

[Edited by - smacker on March 14, 2006 11:32:15 AM]

This topic is closed to new replies.

Advertisement