RPC Weird result
Options
Hey everyone,
In my game I have drawers, doors and some bags to open and I handle it with RPC. But there is some problem door and bags are okay but when it comes the drawer the result is weird. It half opens or doesn't open, it closes immediatly and this happens with jittering. Here is my code when RPC work on bags and doesn't work on drawers.
This is for bag and it works.
This is for drawer and result is weird.
In my game I have drawers, doors and some bags to open and I handle it with RPC. But there is some problem door and bags are okay but when it comes the drawer the result is weird. It half opens or doesn't open, it closes immediatly and this happens with jittering. Here is my code when RPC work on bags and doesn't work on drawers.
This is for bag and it works.
void Update() { if (open && !isOpen) { pView.RPC("OpenLootBag", RpcTarget.All); } } [PunRPC] void OpenLootBag() { mesh.SetBlendShapeWeight(0, Mathf.Lerp(mesh.GetBlendShapeWeight(0), 0, Time.deltaTime * openSpeed)); if (mesh.GetBlendShapeWeight(0) < .1f) isOpen = true; }
This is for drawer and result is weird.
private void Update() { if (useDrawer) pView.RPC("OpenDrawer", RpcTarget.All); } [PunRPC] void OpenDrawer() { if (isOpen) { transform.localPosition = Vector3.SmoothDamp(transform.localPosition, closePos, ref velocity, drawerSpeed); //Close the drawer. if (Vector3.Distance(transform.localPosition, closePos) < .0001f) { useDrawer = false; //If drawer has closed, set useDrawer to false. isOpen = false; } } else { transform.localPosition = Vector3.SmoothDamp(transform.localPosition, openPos, ref velocity, drawerSpeed); //Open the drawer. if (Vector3.Distance(transform.localPosition, openPos) < .0001f) { useDrawer = false; //If drawer has closed, set useDrawer to false. isOpen = true; } } }Where is the problem?
0
Comments
-
Hi @kureysalp,
The forum is mainly for the community.
It's not meant as a free support platform.
We're doing best efforts here.
Besides, it has been less than 2 business days.
Vector3.SmoothDump and PUN RPCs are not related.
The issue is not directly related to PUN.
Thank you for your patience and for your understanding.0