public CharacterObservation CreateCharacterObservation(MyCharacter character) { var orientation = character.PositionComp.GetOrientation(); return(new CharacterObservation { Id = character.EntityId.ToString(), DisplayName = character.DisplayName, Position = character.PositionComp.GetPosition().ToPlain(), // Consider reducing allocations. OrientationForward = orientation.Forward.ToPlain(), OrientationUp = orientation.Up.ToPlain(), Velocity = character.Physics.LinearVelocity.ToPlain(), Extent = character.PositionComp.LocalAABB.Size.ToPlain(), Camera = new Pose() { Position = MySector.MainCamera.Position.ToPlain(), OrientationForward = MySector.MainCamera.ForwardVector.ToPlain(), OrientationUp = MySector.MainCamera.UpVector.ToPlain(), }, JetpackRunning = character.JetpackComp.TurnedOn, HelmetEnabled = character.OxygenComponent.HelmetEnabled, Health = character.StatComp.HealthRatio, Oxygen = character.GetSuitGasFillLevel(MyCharacterOxygenComponent.OxygenId), Hydrogen = character.GetSuitGasFillLevel(MyCharacterOxygenComponent.HydrogenId), SuitEnergy = character.SuitEnergyLevel, HeadLocalXAngle = character.HeadLocalXAngle, HeadLocalYAngle = character.HeadLocalYAngle, TargetBlock = TargetBlock(character), TargetUseObject = UseObject(character), Movement = (CharacterMovementEnum)character.CurrentMovementState, Inventory = GetInventory(character.GetInventory()), BootsState = GetBootState(character), }); }