Skip to content

@LoganBarnett /DroidController.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Syncs Droid movement over the network using dead reckoning
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) {
if (stream.isWriting) {
var position = transform.position;
var rotation = transform.rotation;
stream.Serialize(ref movementSpeed);
stream.Serialize(ref currentHorizontalMovement);
stream.Serialize(ref currentVerticalMovement);
stream.Serialize(ref position);
stream.Serialize(ref rotation);
}
else {
Vector3 position = Vector3.zero;
Quaternion rotation = Quaternion.identity;
stream.Serialize(ref movementSpeed);
stream.Serialize(ref currentHorizontalMovement);
stream.Serialize(ref currentVerticalMovement);
stream.Serialize(ref position);
stream.Serialize(ref rotation);
transform.position = position;
transform.rotation = rotation;
useNetworkInput = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.