public static bool FinerCheck2(DrawableModel model1, DrawableModel model2) { // if (CoarseCheck(model1, model2) == false) // return false; bool collision = false; foreach (ModelMesh mesh1 in model1.Model.Meshes) { BoundingSphere origSphere1 = mesh1.BoundingSphere; Matrix trans1 = model1.OriginalTransforms[mesh1.ParentBone.Index] * model1.WorldMatrix * Matrix.CreateScale(0.0000000001f); BoundingSphere transSphere1 = XNAUtils.TransformBoundingSphere(origSphere1, trans1); foreach (ModelMesh mesh2 in model2.Model.Meshes) { BoundingSphere origSphere2 = mesh2.BoundingSphere; Matrix trans2 = model2.OriginalTransforms[mesh2.ParentBone.Index] * model2.WorldMatrix * Matrix.CreateScale(0.000000001f); BoundingSphere transSphere2 = XNAUtils.TransformBoundingSphere(origSphere2, trans2); if (transSphere1.Intersects(transSphere2)) collision = true; } } return collision; }
public MoveModel1(DrawableModel model, GameModel gameModel, Game1 game, EGGEditor eggEditor) { InitializeComponent(); this.model = model; this.gameModel = gameModel; this.game = game; this.eggEditor = eggEditor; }
public static bool CoarseCheck(DrawableModel model1, DrawableModel model2) { BoundingSphere origSphere1 = (BoundingSphere)model1.Model.Tag; BoundingSphere sphere1 = XNAUtils.TransformBoundingSphere(origSphere1, model1.WorldMatrix); BoundingSphere origSphere2 = (BoundingSphere)model2.Model.Tag; BoundingSphere sphere2 = XNAUtils.TransformBoundingSphere(origSphere2, model2.WorldMatrix); bool collision = sphere1.Intersects(sphere2); return collision; }
private void LoadLevel(SerializeUtils<LevelData> levelData) { models.Clear(); foreach (GameModel model in levelData.Data.models) { string name = GetName(); Model modelType = Content.Load<Model>(name); DrawableModel newModel = new DrawableModel(modelType, Matrix.Identity); newModel.Position = model.position; models.Add(newModel); form.AddToListBox(newModel); form.Prop_ChangeSelected(newModel); } form.IncrementProgressBar(50); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { levelData.models = new List<GameModel>(); //levelData.positions = new List<Vector3>(); camera = new FPSCamera(GraphicsDevice.Viewport); FPS_Counter_On = config.SettingGroups["DebugFeatures"].Settings["FPSCounterOn"].GetValueAsBool(); string name = config.SettingGroups["Filenames"].Settings["person"].GetValueAsString(); person1 = new DrawableModel(Content.Load<Model>(name), Matrix.Identity); name = config.SettingGroups["Filenames"].Settings["terrain"].GetValueAsString(); terrain = new Model(); terrain = Content.Load<Model>(name); sky = Content.Load<Sky>("Models\\sky1"); // Comment this to remove the framerate counter if (FPS_Counter_On == true) { Components.Add(new FrameRateCounter(this)); } base.Initialize(); }
public void UpdatePropertyGrid(DrawableModel model) { propertyGrid1.Update(); }
public void Prop_ChangeSelected(DrawableModel model) { propertyGrid1.SelectedObject = model; }
public void DeleteFromListBox(DrawableModel model) { listBox1.Items.Remove(model); }
public void AddToListBox(DrawableModel model) { listBox1.Items.Add(model); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Text == "Player1") { string name = game.GetName(); DrawableModel newModel = new DrawableModel(game.Content.Load<Model>(name), Matrix.Identity); GameModel gameModel = new GameModel(); game.models.Add(newModel); MoveModel1 moveModel = new MoveModel1(newModel, gameModel,game, this); moveModel.Show(); listBox1.Items.Add(newModel); propertyGrid1.SelectedObject = newModel; } }
private void playerToolStripMenuItem_Click(object sender, EventArgs e) { progressBar1.Show(); progressBar1.Select(); progressBar1.Step = 50; string name = game.GetName(); Model model = game.Content.Load<Model>(name); GameModel gameModel = new GameModel(); DrawableModel newModel = new DrawableModel(model, Matrix.Identity); progressBar1.PerformStep(); game.models.Add(newModel); game.Add(gameModel); MoveModel1 moveModel = new MoveModel1(newModel,gameModel, game , this); moveModel.Show(); listBox1.Items.Add(newModel); propertyGrid1.SelectedObject = newModel; progressBar1.PerformStep(); progressBar1.Value = 0; }