my character uses + or - local scale depending on direction hes facing.
iusing a multiplayer script im trying to get that scale to show up over the network… but i dont know what im doing really… everythings working but the Scale part
internal struct State
{
internal double timestamp;
internal Vector3 pos;
internal Vector3 velocity;
internal Quaternion rot;
------> internal Vector3 scale;
internal Vector3 angularVelocity;
}
// We store twenty states with "playback" information
State[] m_BufferedState = new State[20];
// Keep track of what slots are used
int m_TimestampCount;
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
// Send data to server
if (stream.isWriting)
{
------------------>Vector3 scale = transform.localScale;
Vector3 pos = transform.position;
Quaternion rot = transform.rotation;
//Vector3 velocity = Vector3.zero; //rigidbody.velocity;
//Vector3 angularVelocity = Vector3.zero; // rigidbody.angularVelocity;
stream.Serialize(ref scale);
stream.Serialize(ref pos);
//stream.Serialize(ref velocity);
stream.Serialize(ref rot);
//stream.Serialize(ref angularVelocity);
}
// Read data from remote client
else
{
------> Vector3 scale = Vector3.localScale;
Vector3 pos = Vector3.zero;
Vector3 velocity = Vector3.zero;
Quaternion rot = Quaternion.identity;
Vector3 angularVelocity = Vector3.zero;
stream.Serialize(ref pos);
//stream.Serialize(ref velocity);
stream.Serialize(ref rot);
//stream.Serialize(ref angularVelocity);
// Shift the buffer sideways, deleting state 20
for (int i=m_BufferedState.Length-1;i>=1;i--)
{
m_BufferedState *= m_BufferedState[i-1];*
-
}*
-
// Record current state in slot 0*
-
State state;*
-
state.timestamp = info.timestamp;*
-
state.pos = pos;*
-
state.velocity = velocity;*
-
state.rot = rot;*
------------> state.scale = scale;
-
state.angularVelocity = angularVelocity;*
-
m_BufferedState[0] = state;*
everything with an arrow at it is stuff i threw in trying to make it work. it gave a very odd result. but not one i intended… how do i just tell it to check if the scale of the darn thing!