Please continue next part on how to grab and how to client grab the object if any request state authority because i have a problem face in grabbing object
Add a "PointableUnityEventWrapper" component on the interactable and reference the "Grabbable" component Create a new script "RequestStateAuthorityForInteractionKinematic". using Fusion; using Oculus.Interaction; using UnityEngine; public class RequestStateAuthorityForInteractionKinematic : NetworkBehaviour { [SerializeField] private PointableUnityEventWrapper pointableUnityEventWrapper; [SerializeField] private bool GrabbedWhileSelected = false; [Networked] public bool IsGrabbed { get; set; } private bool prevValue; private void Start() { pointableUnityEventWrapper.WhenHover.AddListener(RequestAuthorityToInteract); pointableUnityEventWrapper.WhenSelect.AddListener(OnSelected); pointableUnityEventWrapper.WhenUnselect.AddListener(OnUnslected); } private void RequestAuthorityToInteract(PointerEvent arg0) { if (GrabbedWhileSelected) { Object.RequestStateAuthority(); } else if (!Object.HasStateAuthority) { if (!IsGrabbed) Object.RequestStateAuthority(); else Debug.Log("
Hello, I tried this whole scrip and wathced previous video. But when I make a shared room, I can't change spawn point. Everytime spawn point is fixed by OVR rig camera's position. How can I fix it?
@@gamedevelopersukanta414 Add a "PointableUnityEventWrapper" component on the interactable and reference the "Grabbable" component Create a new script "RequestStateAuthorityForInteractionKinematic". using Fusion; using Oculus.Interaction; using UnityEngine; public class RequestStateAuthorityForInteractionKinematic : NetworkBehaviour { [SerializeField] private PointableUnityEventWrapper pointableUnityEventWrapper; [SerializeField] private bool GrabbedWhileSelected = false; [Networked] public bool IsGrabbed { get; set; } private bool prevValue; private void Start() { pointableUnityEventWrapper.WhenHover.AddListener(RequestAuthorityToInteract); pointableUnityEventWrapper.WhenSelect.AddListener(OnSelected); pointableUnityEventWrapper.WhenUnselect.AddListener(OnUnslected); } private void RequestAuthorityToInteract(PointerEvent arg0) { if (GrabbedWhileSelected) { Object.RequestStateAuthority(); } else if (!Object.HasStateAuthority) { if (!IsGrabbed) Object.RequestStateAuthority(); else Debug.Log("
Good video! I don't understand what's happening at 5:11 though. It seems like commenting out that code would result in a different bug (resulting in 1 player one, 2 player twos, 3 player threes, etc). Can you explain it more?
If you don't have a condition in place to check if the player is joining is local to you or not, then every time a new player joins, the runner will duplicate the existing players. Let's say you joined 1st, the room will have just you, then when I join, the runner will spawn your player once again along with mine, so now the room will have two of you and one of me instead of just one of us each.
@immersiveinsiders Ok, maybe I have a misunderstanding of what is happening. I am assuming the parameter "PlayerRef" in the method OnPlayerJoined is a reference to the player who just joined (the player with the most recent join time) Assuming we remove the condition (player == runner.localPlayer): When Player 2 joins a room, I would assume that P1's callback fires, and P2's callback fires. This would result (incorrectly) in 2 Player2s, correct? To rephrase, the list of callbacks would be: OnPlayerJoined (player1) -- calledBy: player1-- (localPlayer == true) OnPlayerJoined (player2) -- calledBy: player1-- (localPlayer == false) OnPlayerJoined (player2) -- calledBy: player2-- (localPlayer == true) Now that I've typed this all out, I think I see where we're maybe getting confused. The 2nd line (which should be omitted) would spawn a Player1 prefab, but its Input Authority would be Player2, is that correct?
Please continue next part on how to grab and how to client grab the object if any request state authority because i have a problem face in grabbing object
Add a "PointableUnityEventWrapper" component on the interactable and reference the "Grabbable" component
Create a new script "RequestStateAuthorityForInteractionKinematic".
using Fusion;
using Oculus.Interaction;
using UnityEngine;
public class RequestStateAuthorityForInteractionKinematic : NetworkBehaviour
{
[SerializeField] private PointableUnityEventWrapper pointableUnityEventWrapper;
[SerializeField] private bool GrabbedWhileSelected = false;
[Networked]
public bool IsGrabbed { get; set; }
private bool prevValue;
private void Start()
{
pointableUnityEventWrapper.WhenHover.AddListener(RequestAuthorityToInteract);
pointableUnityEventWrapper.WhenSelect.AddListener(OnSelected);
pointableUnityEventWrapper.WhenUnselect.AddListener(OnUnslected);
}
private void RequestAuthorityToInteract(PointerEvent arg0)
{
if (GrabbedWhileSelected)
{
Object.RequestStateAuthority();
}
else if (!Object.HasStateAuthority)
{
if (!IsGrabbed)
Object.RequestStateAuthority();
else
Debug.Log("
@@immersiveinsiders thanks brother
Very helpful video
Hello, I tried this whole scrip and wathced previous video. But when I make a shared room, I can't change spawn point. Everytime spawn point is fixed by OVR rig camera's position. How can I fix it?
That's strange, because the spawn points are randomized.
"RequestStateAuthorityForInteractionKinematic" where i attach this script and this script is allow to client grab function ?
You need to attach on the object you'd want to be grabbed across the network.
@@immersiveinsiders client is not able to grab object only host can grab but i want to client also grab the object
@@gamedevelopersukanta414 can you confirm that you are using shared topology? Same as this video?
@@immersiveinsiders yes I use shared topology same as video
@@gamedevelopersukanta414
Add a "PointableUnityEventWrapper" component on the interactable and reference the "Grabbable" component
Create a new script "RequestStateAuthorityForInteractionKinematic".
using Fusion;
using Oculus.Interaction;
using UnityEngine;
public class RequestStateAuthorityForInteractionKinematic : NetworkBehaviour
{
[SerializeField] private PointableUnityEventWrapper pointableUnityEventWrapper;
[SerializeField] private bool GrabbedWhileSelected = false;
[Networked]
public bool IsGrabbed { get; set; }
private bool prevValue;
private void Start()
{
pointableUnityEventWrapper.WhenHover.AddListener(RequestAuthorityToInteract);
pointableUnityEventWrapper.WhenSelect.AddListener(OnSelected);
pointableUnityEventWrapper.WhenUnselect.AddListener(OnUnslected);
}
private void RequestAuthorityToInteract(PointerEvent arg0)
{
if (GrabbedWhileSelected)
{
Object.RequestStateAuthority();
}
else if (!Object.HasStateAuthority)
{
if (!IsGrabbed)
Object.RequestStateAuthority();
else
Debug.Log("
Good video!
I don't understand what's happening at 5:11 though. It seems like commenting out that code would result in a different bug (resulting in 1 player one, 2 player twos, 3 player threes, etc). Can you explain it more?
If you don't have a condition in place to check if the player is joining is local to you or not, then every time a new player joins, the runner will duplicate the existing players.
Let's say you joined 1st, the room will have just you, then when I join, the runner will spawn your player once again along with mine, so now the room will have two of you and one of me instead of just one of us each.
@immersiveinsiders
Ok, maybe I have a misunderstanding of what is happening. I am assuming the parameter "PlayerRef" in the method OnPlayerJoined is a reference to the player who just joined (the player with the most recent join time)
Assuming we remove the condition (player == runner.localPlayer):
When Player 2 joins a room, I would assume that P1's callback fires, and P2's callback fires. This would result (incorrectly) in 2 Player2s, correct?
To rephrase, the list of callbacks would be:
OnPlayerJoined (player1) -- calledBy: player1-- (localPlayer == true)
OnPlayerJoined (player2) -- calledBy: player1-- (localPlayer == false)
OnPlayerJoined (player2) -- calledBy: player2-- (localPlayer == true)
Now that I've typed this all out, I think I see where we're maybe getting confused. The 2nd line (which should be omitted) would spawn a Player1 prefab, but its Input Authority would be Player2, is that correct?
@@AndrewDeick Yes, you got that right!
❤❤❤❤🎉🎉🎉