private void FixedUpdate()
        {
            var newPosition = transform.position.ToCoordinates();
            var newRotation = ComponentUtils.QuantizeAngle(transform.rotation.eulerAngles.y);

            fixedFramesSinceLastUpdate++;
            if ((PositionNeedsUpdate(newPosition) || RotationNeedsUpdate(newRotation)) && fixedFramesSinceLastUpdate > SimulationSettings.TransformUpdatesToSkipBetweenSends)
            {
                fixedFramesSinceLastUpdate = 0;
                transformComponent.Update.Position(newPosition).Rotation(newRotation).FinishAndSend();
            }
        }
 private void Update()
 {
     if (IsNotAnAuthoritativePlayer())
     {
         myRigidbody.MovePosition(Vector3.Lerp(myRigidbody.position, transformComponent.Data.position.ToVector3(), 0.2f));
         myRigidbody.MoveRotation(Quaternion.Euler(0f, ComponentUtils.DequantizeAngle(transformComponent.Data.rotation), 0f));
     }
     else if (isRemote)
     {
         TearDownRemoveTransform();
     }
 }
Esempio n. 3
0
 private void UpdateTransform()
 {
     myRigidbody.MovePosition(transformComponent.Data.position.ToVector3());
     myRigidbody.MoveRotation(Quaternion.Euler(0f, ComponentUtils.DequantizeAngle(transformComponent.Data.rotation), 0f));
 }
 private void SetRotation(uint rotation)
 {
     transform.rotation = Quaternion.Euler(0f, ComponentUtils.DequantizeAngle(rotation), 0f);
 }