Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: utopien on April 13, 2018, 08:57:37 AM
-
Hi guys i have been able to sync the pos and Rot of a player but to sync a doors that is lunch by bool any idees ?
-
Hi,
is it not working with an Fsmbool being synched?
Bye,
Jean
-
Hi jean Thanks for your reply
when i sync The fsm bool it work only from master client the doors open for every one but a regular cleint can not open the doors any idée ?
-
Hi,
that's odd indeed. on what kind of photonView are you synching this boolean? is it a scene object or a instantiated network gameobject?
Bye,
Jean
-
Hi ,
Yes weird isn't it The Game object is already in scene it is not instantiate..
the doors open By lunching a Bool test With the bool "Isopen" is set by a children GO open Button which contain an FSM on mousse Click event it Set the Fsm Parent Sync Bool "Isopen" to true With th set fsm Bool Action it works perfectly on local I have synchronized the "Iopen" door and put into the Photon view I have placed FSM which contain the Sync "Isopen" it work only when the master client opened the door then the rest of the client see door open but when any client want to interact with the door this time the bool is no longer synchronized it's kind of drove me crazy because the process seems to be very simple so I have updated on the asset store photon in case it wasn't the issue but the problem remain if you think it's better I can post a little video which show you exactly my problem can help ?? Right one
-
Hi,
I understand the repro case, I'll work on this and check if I can fix this.
Bye,
Jean
-
HI Thanks a Lot
-
Hi,
all is working well, I think you are simply missing the very important fact that a networked scene Object belong to the MasterClient, and so only the masterClient can set the boolean value on that gameobject.
for all your players to be able to interact with the door, they need to fire an RPC to the MasterClient, so that the MasterClient open that door for you.
Does that make sense?
Bye,
Jean
-
thanks for checking for my problème in did i tried with RPC and it seem yes to be the solution but i think i didn t get the full logic yet because it i have try to send rpc it work for moment only from the master and only on all and bradcast all for i can not target an FSM or use send rpc with data cause i need to know doors is it to not open all the doors but as said i didnt get the logic yet it is to bas that i found only tutorial on that subject rpc with playmaker
i will continue my search and get back to you
thanks again ! jean
By the WAY i found sync rotation with quaterinion is better result than Euler so i custumize the verctor3 lerp Advanced to Quaternion Lerp Advenced if you think it can help here the modif code it work perfectly
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Vector3)]
[Tooltip("Linearly interpolates between 2 vectors.\n Advanced features allows selection of update type and lerp against deltaTime for the amount, allowing framerate indepedant animations.")]
public class QuaternionLerpAdvanced : FsmStateAction
{
[RequiredField]
[Tooltip("First Vector.")]
public FsmQuaternion fromQuaternion;
[RequiredField]
[Tooltip("Second Vector.")]
public FsmQuaternion toQuaternion;
[RequiredField]
[Tooltip("Interpolate between From Vector and ToVector by this amount. Value is clamped to 0-1 range. 0 = From Vector; 1 = To Vector; 0.5 = half way between.")]
public FsmFloat amount;
[Tooltip("Amount is multiplied by the deltatime")]
public bool lerpAgainstDeltaTime;
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("Store the result in this vector variable.")]
public FsmQuaternion storeResult;
public PlayMakerActionsUtils.EveryFrameUpdateSelector updateType;
[Tooltip("Repeat every frame. Useful if any of the values are changing.")]
public bool everyFrame;
public override void Reset()
{
fromQuaternion = new FsmQuaternion { UseVariable = true };
toQuaternion = new FsmQuaternion { UseVariable = true };
amount = null;
lerpAgainstDeltaTime = false;
storeResult = null;
updateType = PlayMakerActionsUtils.EveryFrameUpdateSelector.OnUpdate;
everyFrame = true;
}
public override void OnUpdate()
{
if (updateType == PlayMakerActionsUtils.EveryFrameUpdateSelector.OnUpdate)
{
DoQuaternionLerp();
}
if (!everyFrame)
{
Finish();
}
}
public override void OnLateUpdate()
{
if (updateType == PlayMakerActionsUtils.EveryFrameUpdateSelector.OnLateUpdate)
{
DoQuaternionLerp();
}
if (!everyFrame)
{
Finish();
}
}
public override void OnFixedUpdate()
{
if (updateType == PlayMakerActionsUtils.EveryFrameUpdateSelector.OnFixedUpdate)
{
DoQuaternionLerp();
}
if (!everyFrame)
{
Finish();
}
}
void DoQuaternionLerp()
{
float _amount = lerpAgainstDeltaTime?Time.deltaTime*amount.Value:amount.Value;
storeResult.Value = Quaternion.Lerp(fromQuaternion.Value, toQuaternion.Value, _amount);
}
}
}
-
Hi,
ok, Cool, I'll add this action to the ecosystem.
let me know if you keep struggling, I have a working mod of the demo scene with two doors working.
the key is to name your doors with unique names, and when sending the rpc pass the name of the door that needs to be open or close, then each door will receive it ( because they all belong to the same player, the masterClient), and so they can check if that call is for them or not by comparing their name with the name passed with the rpc.
Bye,
Jean
-
HI
that is a great news !!!! thanks it could save me a lot time !
-
Hi,
There you go. There will be two doors, that both players can open and close, and even when a player joins late, the door will adjust to the current state ( one could actually not animate the door opening, but straight away to to the open state, but that's cosmetic already)
link below:
https://www.dropbox.com/s/3wuacqaermt5nka/PUNDemoWorker.unitypackage?dl=0
Bye,
Jean
-
Thanks so much Jean you have really been a great help
just so you know i found way but your aproch is much more straight forward it did help ti understand better the logic thanks again
jean
-
Hi,
good, I am glad I could help :)
Bye,
Jean