finally fixed hands locally
parent
22e4888c93
commit
e315a7da78
|
|
@ -37,6 +37,23 @@ public class VelNetSyncHand : NetworkSerializedObject
|
|||
public Transform Thumb3;
|
||||
*/
|
||||
#endregion
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
targets = new Quaternion[toSync.Length];
|
||||
InvokeRepeating("NetworkSend", 0, 1 / serializationRateHz);
|
||||
}
|
||||
|
||||
//TODO: remove when NetworkSerializedObject works
|
||||
private void NetworkSend()
|
||||
{
|
||||
if (IsMine && hand != null && hand.IsDataValid)
|
||||
{
|
||||
SendBytes(SendState());
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ReceiveState(byte[] message)
|
||||
{
|
||||
using MemoryStream mem = new MemoryStream(message);
|
||||
|
|
@ -59,16 +76,10 @@ public class VelNetSyncHand : NetworkSerializedObject
|
|||
return mem.ToArray();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
targets = new Quaternion[toSync.Length];
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (IsMine && hand?.Bones != null && hand?.Bones.Count == toSync.Length) //need to set values from tracked hand to this networkobject
|
||||
if (IsMine && hand?.Bones != null && hand.IsDataValid) //need to set values from tracked hand to this networkobject
|
||||
{
|
||||
for(int i = 0; i < toSync.Length; i++)
|
||||
{
|
||||
|
|
@ -77,9 +88,13 @@ public class VelNetSyncHand : NetworkSerializedObject
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!IsMine) {
|
||||
for (int i = 0; i < targets.Length; i++)
|
||||
{
|
||||
toSync[i].rotation = Quaternion.Slerp(transform.rotation, targets[i], 1 / smoothness / serializationRateHz);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,6 +642,10 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: OVRHandPrefab
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1870938896605422, guid: 835e735ca71bf78459fb2cababd74112, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4453513310108136, guid: 835e735ca71bf78459fb2cababd74112, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
|
|
@ -1833,7 +1837,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 03a4d4e1a7fd74c7ab2eccca4ce168db, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
host: 129.159.107.234
|
||||
host: neko.ugavel.com
|
||||
port: 3290
|
||||
udpConnected: 0
|
||||
userid: -1
|
||||
|
|
@ -2545,6 +2549,10 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: OVRHandPrefab
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1870938896605422, guid: 835e735ca71bf78459fb2cababd74112, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4453513310108136, guid: 835e735ca71bf78459fb2cababd74112, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue