I've been wondered how to to make FPS game camera system work over network. The collisions are happening at the server side and server cares about player position. But the rotation of the players is the problem. I've been thought many different ways to make it and I don't have any good idea for that. Server has to know player rotation so it can send them to other clients. Is it possible way to do camera system like that: Client sends a camera rotation to server -> Server sends camera rotation to all other players so other clients know the rotation. Is there something what I have to notice about collisions? And by the way, is it possible to get camera rotation?
Thx for the help
How to make FPSCamera system work over network?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Sure, that sounds workable.
What you send depends on what you mean by 'rotation'. Cameras have a direction vector and an up vector. You can retrieve them simply with:
If you actually want the rotations, then it depends on how many axes you need:
If you need Z (roll), eh, we'll cross that bridge when we come to it.
What you send depends on what you mean by 'rotation'. Cameras have a direction vector and an up vector. You can retrieve them simply with:
Code: Select all
vector3df direction = (camera->getTarget() - camera->getAbsolutePosition()).normalize();
camera->getUpVector();
Code: Select all
// Gets X and Y rotations (i.e. pitch and yaw)
vector3df cameraRotations = direction.getHorizontalAngle();
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way