public override ShapeBase CreateShapeInstance() { HavokNavMeshTestPathShape shape = new HavokNavMeshTestPathShape("NavMesh_TestPath"); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; return(shape); }
public override bool OnPick(MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod) { // base implementation releases the pick handler base.OnPick(e, eKeyMod); ShapeCollection selection = EditorManager.SelectedShapes; foreach (ShapeBase shape in selection) { if (shape is HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape) { Vector3F vStart = new Vector3F(); Vector3F vEnd = new Vector3F(); EditorManager.EngineManager.GetRayAtScreenPos(out vStart, out vEnd, e.X, e.Y, EditorManager.Settings.MaxPickingDistance); ShapeTraceResult result = new ShapeTraceResult(); ShapeCollection relevantShapes = EditorManager.Scene.RootShapes; foreach (ShapeBase relevantShape in relevantShapes) { relevantShape.TraceShape(ShapeTraceMode_e.ShapePicking, vStart, vEnd, ref result, true); } if (result.bHit) { Vector3F dir = vEnd - vStart; dir.Normalize(); Vector3F hitPoint = vStart + dir * result.fHitDistance; HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape path = shape as HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape; if (m_start) { path.StartPoint = hitPoint; } else { path.EndPoint = hitPoint; } } break; } } return(true); }
private void IgnoreCheckBox_CheckedChanged(object sender, EventArgs e) { if (m_ignoreCheckBoxChanged) { return; } ShapeCollection selection = EditorManager.SelectedShapes; foreach (ShapeBase shape in selection) { if (shape is HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape) { HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape path = shape as HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape; path.Visible = !path.Visible; break; } } EditorManager.ActiveView.UpdateView(true); }
void EditorManager_ShapeSelectionChanged(object sender, ShapeSelectionChangedArgs e) { if ((EditorManager.Scene == null) || (EditorManager.Scene.AllShapesOfType(typeof(HavokAiEditorPlugin.Shapes.HavokNavMeshShape)).Count == 0)) { return; } int numPaths = 0; bool showPath = false; foreach (ShapeBase shape in e.NewSelection) { if (shape is HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape) { numPaths++; HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape path = shape as HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape; showPath = path.Visible; } } _panel.EnablePathDependentControls(numPaths == 1, showPath); }
public override ShapeBase CreateShapeInstance() { HavokNavMeshTestPathShape shape = new HavokNavMeshTestPathShape("NavMesh_TestPath"); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; return shape; }