2.2. General Advice

2.2.1. Further Reading

You should make yourself familiar with the Unity engine and some of its packages as well as libigl.

2.2.2. How to start developing

  1. Find a good IDE and learn how to do basic things such as:

    1. Go to definition (!)

    2. Refactor names

    3. Collapse all comments, #regions

    4. Syntax highlighting and intellisense

    5. Display quick documentation, Crl + Q in JetBrains

  2. Setup your debugger so you can set a breakpoint

  3. Set up/find out some keyboard shortcuts

  4. In C++ use the LOG macros

  5. Have a look at the existing functionality and use it as an example

2.2.3. C# Features

  • Use LINQ for manipulating arrays and lists

  • Follow some of the advice from the Refactoring Guru

    • Mainly, keep files small and separate independent features.

2.2.4. Use of Bitmasks

Bitmasks are used often in this project for compact/efficient boolean storage. A common example is the selection vector. We have one 32-bit integer for each vertex, equivalent to 32 booleans per vertex. Each bit represents if the vertex is in that selection or not. There are some common operations with bitwise operators you may want to do. Please consider operator precedence.

  1. Check if i-th bit is set (flags & 1 << i) > 0

  2. Set i-th bit flags |= 1 << i;

  3. Unset i-th bit flags &= ~(1 << i);

Note that 1 << i can also be a mask of several bits or a predefined constant.

2.2.5. VR Hands

  • Anything that is related to the controllers always has a left L and right R. This means lots of parameters are essentially duplicated.

  • Functions that are independent of these variables are often made and named *Generic()

  • For booleans: Left = false, Right = true

2.2.6. Advanced

  1. Be aware of the ‘Enter Play Mode Settings’ in Project Settings > Editor

    1. Reload Domain is expensive but ensures that things such as static variables are properly reset when pressing play. This can cause issues not present in a Build, make sure you clean up during OnDestroy.