Editing an Existing MAGES Project

After playing an existing operation once (for example the Neuromonitoring Sample), you might realise that you need to make some adjustments to the project to suit your needs. In this tutorial we will take a look on how to edit a MAGES Project by creating extra Actions and Analytics.

Create Parallel Actions

Parallel Actions are Actions that branch out from a single Action Node. We will create some Actions that run parallel to the others after the Subplastimal Incision Action (4th from the start).

First lets create a new Use Action using the Action Wizard:

  1. Navigate to MAGES > MAGES Panel to open the MAGES Panel, then select the Scenegraph Editor tab.

    ../../_images/1_open_action_wizard.png

    The Action Pattern Wizard will show up on the MAGES Panel and the operation’s Scenegraph will open.

  2. From the Action Wizard select the Use Action option, name the Action “Cut Protrusion” and then click on the Next button.

    ../../_images/2_name_action.png
  3. The Action Wizard will give you the option to either create a new Interactable object to use for that Action or select an existing one. In our case we will use the Scalpel prefab provided with the Sample.

    ../../_images/3_use_object.png

    After selecting the Scalpel as the Use Object, click on Next.

  4. Now the Action Wizard will provide similar options for the Use Collider object of the Action as well. This time we will create a new Sphere to act as the Use Collider by simply clicking on the Create New button and selecting the DebugProbe prefab.

    ../../_images/4_use_collider_search.png

    An instance of that prefab will spawn on the Scene. As the DebugProbe is huge, adjust its scale to 3 on each axis from the Inspector and change its position so that it rests on top of the table.

    ../../_images/5_use_collider_placement.png
  5. Let’s add a custom material on the Use Collider object. Navigate to your desired folder in Assets, right click and select Create > Material to create a new Material. After giving it a proper name (for example “Protrusion Material”), go to the Inspector of the new material and assign Fat_Albedo as its base map. You can also darken its color a little bit.

    After creating the new material, add it to the new Use Collider by dragging the material on it.

    ../../_images/6_protrusion_material.png
  6. Afterward, add a Sphere Collider on the Use Collider object and through the Action Wizard click on the Finish button to finalize the creation of the new Use Action. Now the new Use Action Node will appear at the end of the Scenegraph. Delete the new node’s connections, move it bellow the “Subplastimal Incision” Action Node and link it to the “Fat Incision” Node.

    ../../_images/7_link_node.png

That’s it! You have added a new Use Action inside the Samples Scenegraph which is initialized after the “Fat Incision” action.

Now let’s create a Remove Action after the “Cut Protrusion” Action we just created.

  1. Open the Scenegraph of the current project either via the MAGES Panel or through the Edit Scenegraph button on the Scene view. Right click on the empty space next to the “Cut Protrusion” Action, then select New Action > Remove Action. Name the new Action “Remove Protrusion” and connect it to the “Cut Protrusion” Action.

    ../../_images/8_remove_action.png
  2. Assign the object we previously used as the Use Collider to the Remove Object field.

    ../../_images/9_remove_object.png

And simply as that you have added another new Action to the existing Project’s Scenegraph. Now you can press play and test the results.

Add a new Objective

We can also modify the Analytics of the existing project. In our case we will add a new Objective to the operation that will be completed in case we do not collide the Protrusion with the bottom tray during the new Remove Action.

  1. Navigate to MAGES > MAGES Panel to open the MAGES Panel, then select the Analytics Editor tab.

    ../../_images/10_analytics_editor.png
  2. Inside the Analytics Editor navigate to the Objectives tab, then select Collision as the Objective type.

    ../../_images/11_objective_tab.png
  3. Click on the Add New Objective button. After providing it with a proper name and description, set its Collision Type to Enter and assign the Protrusion prefab as the Error Prefab.

    ../../_images/12_assigning_prefab.png
  4. We also need to create a new Collider prefab for the Collision Objective. Without closing the MAGES Panel, create a new Box Collider surrounding the bottom tray (or simply find the collider gameobject corresponding to the bottom tray) and drag it to the preferred Assets folder to create a new prefab based on that gameObject.

    ../../_images/13_create_collider_prefab.png
  5. Assign the newly created prefab on the Error Collider field, set the Action field to “Remove Protrusion” and as rule set it to Do not collide. Lastly click on the Add button to add the new Objective.

    ../../_images/14_objective_done.png

Now your operation has a new Collision Objective. You can check whether you achieved it during your playthrough at the end of the operation.