private static MyCharacter CreateCharacterBase(MatrixD worldMatrix, ref Vector3 velocity, string characterName, string model, Vector3? colorMask, bool AIMode, bool useInventory = true, MyBotDefinition botDefinition = null) { MyCharacter character = new MyCharacter(); MyObjectBuilder_Character objectBuilder = MyCharacter.Random(); objectBuilder.CharacterModel = model ?? objectBuilder.CharacterModel; if (colorMask.HasValue) objectBuilder.ColorMaskHSV = colorMask.Value; objectBuilder.JetpackEnabled = MySession.Static.CreativeMode; objectBuilder.Battery = new MyObjectBuilder_Battery { CurrentCapacity = 1 }; objectBuilder.AIMode = AIMode; objectBuilder.DisplayName = characterName; objectBuilder.LinearVelocity = velocity; objectBuilder.PositionAndOrientation = new MyPositionAndOrientation(worldMatrix); character.Init(objectBuilder); MyEntities.RaiseEntityCreated(character); MyEntities.Add(character); System.Diagnostics.Debug.Assert(character.GetInventory() as MyInventory != null, "Null or unexpected inventory type returned!"); if (useInventory) MyWorldGenerator.InitInventoryWithDefaults(character.GetInventory() as MyInventory); else if (botDefinition != null) { // use inventory from bot definition botDefinition.AddItems(character); } //character.PositionComp.SetWorldMatrix(worldMatrix); if (velocity.Length() > 0) { var jetpack = character.JetpackComp; if (jetpack != null) jetpack.EnableDampeners(false, false); } return character; }