Some progress on sending updates
This commit is contained in:
parent
8cf6002858
commit
ae6d704c1b
@ -9,8 +9,8 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4191195719973714}
|
||||
- component: {fileID: 114636771493283014}
|
||||
- component: {fileID: 1251152422678924623}
|
||||
- component: {fileID: 114636771493283014}
|
||||
m_Layer: 0
|
||||
m_Name: HumanoidPlayer
|
||||
m_TagString: Untagged
|
||||
@ -33,6 +33,27 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1251152422678924623
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1810220956971058}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
GlobalObjectIdHash: 1317207860
|
||||
InScenePlacedSourceGlobalObjectIdHash: 0
|
||||
AlwaysReplicateAsRoot: 0
|
||||
SynchronizeTransform: 1
|
||||
ActiveSceneSynchronization: 0
|
||||
SceneMigrationSynchronization: 1
|
||||
SpawnWithObservers: 1
|
||||
DontDestroyWithOwner: 0
|
||||
AutoObjectParentSync: 1
|
||||
--- !u!114 &114636771493283014
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -48,27 +69,6 @@ MonoBehaviour:
|
||||
_syncFingerSwing: 0
|
||||
_syncFace: 0
|
||||
_syncTracking: 0
|
||||
_debug: 3
|
||||
_debug: 1
|
||||
_sendRate: 25
|
||||
_createLocalRemotes: 0
|
||||
--- !u!114 &1251152422678924623
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1810220956971058}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
GlobalObjectIdHash: 2555736071
|
||||
InScenePlacedSourceGlobalObjectIdHash: 0
|
||||
AlwaysReplicateAsRoot: 0
|
||||
SynchronizeTransform: 1
|
||||
ActiveSceneSynchronization: 0
|
||||
SceneMigrationSynchronization: 1
|
||||
SpawnWithObservers: 1
|
||||
DontDestroyWithOwner: 0
|
||||
AutoObjectParentSync: 1
|
||||
_createLocalRemotes: 1
|
||||
|
@ -30,6 +30,7 @@ namespace Passer.Humanoid {
|
||||
HumanoidNetworking.DebugLevel debug { get; }
|
||||
HumanoidNetworking.Smoothing smoothing { get; }
|
||||
bool createLocalRemotes { get; set; }
|
||||
Vector3 localRemotePosition { get; }
|
||||
|
||||
|
||||
bool isLocal { get; }
|
||||
@ -1010,7 +1011,7 @@ namespace Passer.Humanoid {
|
||||
ReceiveHumanoidPose(remoteHumanoid, humanoidPose, networking.lastHumanoidPose, networking.smoothing);
|
||||
|
||||
if (networking.createLocalRemotes)
|
||||
remoteHumanoid.transform.Translate(0, 0, 1, Space.Self);
|
||||
remoteHumanoid.transform.Translate(networking.localRemotePosition, Space.Self);
|
||||
|
||||
networking.lastHumanoidPose = humanoidPose;
|
||||
}
|
||||
|
@ -66,9 +66,16 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
public GameObject GetGameObject(ulong objIdentity) {
|
||||
// Generic Objects
|
||||
Unity.Netcode.NetworkObject nwObject = GetNetworkObject(objIdentity);
|
||||
if (nwObject == null)
|
||||
return null;
|
||||
if (nwObject == null) {
|
||||
// Player Objects
|
||||
nwObject = NetworkManager.Singleton.ConnectedClients[objIdentity].PlayerObject;
|
||||
if (nwObject != null)
|
||||
return nwObject.gameObject;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
GameObject gameObject = nwObject.gameObject;
|
||||
return gameObject;
|
||||
}
|
||||
@ -81,11 +88,33 @@ namespace Passer.Humanoid {
|
||||
get { return _createLocalRemotes; }
|
||||
set { _createLocalRemotes = value; }
|
||||
}
|
||||
protected Vector3 _localRemotePosition = new(0, 0, -1);
|
||||
public Vector3 localRemotePosition { get { return _localRemotePosition; } }
|
||||
|
||||
|
||||
#region Init
|
||||
|
||||
public void Awake() {
|
||||
if (identity == null)
|
||||
identity = GetComponent<Unity.Netcode.NetworkObject>();
|
||||
|
||||
humanoids = HumanoidNetworking.FindLocalHumanoids();
|
||||
|
||||
if (debug <= HumanoidNetworking.DebugLevel.Info)
|
||||
DebugLog("Found " + humanoids.Count + " Humanoids");
|
||||
|
||||
for (int i = 0; i < humanoids.Count; i++) {
|
||||
HumanoidControl humanoid = humanoids[i];
|
||||
if (humanoid.isRemote || createLocalRemotes == false)
|
||||
continue;
|
||||
|
||||
humanoid.humanoidNetworking = this;
|
||||
((IHumanoidNetworking)this).InstantiateHumanoid(humanoid);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnStartClient() {
|
||||
Debug.Log("starting client");
|
||||
//name = name + " " + netId;
|
||||
|
||||
NetworkManager nwManager = FindObjectOfType<NetworkManager>();
|
||||
@ -108,6 +137,7 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
public virtual void OnStartServer() {
|
||||
Debug.Log("starting server");
|
||||
//short msgType = MsgType.Highest + 1;
|
||||
//NetworkServer.RegisterHandler(msgType, ForwardAvatarPose);
|
||||
}
|
||||
@ -195,6 +225,8 @@ namespace Passer.Humanoid {
|
||||
if (debug <= HumanoidNetworking.DebugLevel.Info)
|
||||
Debug.Log((int)identity.NetworkObjectId + ": Destroy Remote Humanoid");
|
||||
|
||||
if (humanoids == null)
|
||||
return;
|
||||
foreach (HumanoidControl humanoid in humanoids) {
|
||||
if (humanoid == null)
|
||||
continue;
|
||||
|
@ -51,6 +51,9 @@ namespace Passer.Humanoid {
|
||||
get { return _createLocalRemotes; }
|
||||
set { _createLocalRemotes = value; }
|
||||
}
|
||||
protected Vector3 _localRemotePosition = new(0, 0, -1);
|
||||
public Vector3 localRemotePosition { get { return _localRemotePosition; } }
|
||||
|
||||
|
||||
public bool isLocal { get; set; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user