Hello,
I wasted more than 1 month to make it, but I have no more idea. I work on a really simple FPS which has SP and multiplayer. The game uses custom door models which has an opening opening animation.
The actual status: the server-player can opening the door and the client can see the animation and can walk normally through the opened door, but the client cannot open. The door has networkID and the Local Player Authority is checked + the Door prefab is inserted into the Network manager. I use Legacy animations.
The actual mechanism in the codes:
- if player’s raycast is hitting the door and pressing use key, it’s activating the CmdOpening() function in the door’s script which plays the animation, further codes are below:
@Command
public function CmdOpening ()
{
RpcOpening();
}
@ClientRpc
public function RpcOpening ()
{
if ( DoorState == DoorPos.IsClosed || DoorState == DoorPos.IsClosing )
{
GetComponent.<Animation>()["Open"].normalizedSpeed = 1.0;
GetComponent(Animation).Play("Open");
DoorState = DoorPos.IsOpening;
}
else if ( DoorState == DoorPos.IsOpened || DoorState == DoorPos.IsOpening )
{
GetComponent.<Animation>()["Open"].normalizedSpeed = -1.0;
GetComponent(Animation).Play("Open");
DoorState = DoorPos.IsClosing;
}
}
Any help would be great!