Handling GameObject by Server and Client (Network Manager)
Hello, I want to create a Cardboard-App, where you can see around by cardboard and walk with a game controller. I realized that by wireless lan. The player is a Network-Object. The server (my computer) gets the controller-input and send it to the client (smartphone), whereas the client tracks the head-movement (because I dont want to connect my smartphone directly with the controller via usb). Now I want to send the head position to the server, to walk with the controller along the direction of the head. That's a huge problem for me, because either the client can controll the player object or vice versa, but not both participants can controll it. I tried to use the deprecated RPC-Calls, too. Thank you for answers!
void MovementManagement(float horizontal, float vertical, bool sneaking)
{
if(!isServer)
{
if (isLocalPlayer) {
transform.Rotate(new Vector3(0,Input.GetAxis("Mouse X")*3,0));
}
return;
}
anim.SetBool (hash.sneakingBool, sneaking);
if (horizontal != 0f || vertical != 0f) {
anim.SetFloat (hash.speedFloat, 5.5f, speedDampingTime, Time.deltaTime);
transform.position += (transform.forward * vertical + transform.right * horizontal ) * speed;
} else {
anim.SetFloat (hash.speedFloat, 0f);
}
}
Answer by Moritz89 · Oct 04, 2016 at 12:55 PM
Input.GetAxis("Mouse X") stands for the head-position. It's just for test, sry I forget to mention that.
Your answer
Follow this Question
Related Questions
Lerping to Smooth Network Movement 0 Answers
Communication between Photon Cloud game and web server 0 Answers
Spawn Objects in a Server UNet 0 Answers
UNET | How to use network messages? 1 Answer