Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1| Overview

The N-Precision Monobehavior base-class allows you to quickly create a new Unity3D Monobehavior that manages transformations for Double- or Single Precision automatically, and allows the end user to switch between double- and single precision mode in both editor and runtime.

Info

As an end-user you rarely care about how your transformations are applied onto the Game-object, however you do want them to be applied properly, and without breaking the different transformation systems that exist inside unity - the NPrecisionMonobehavior serves this particular interface function.

2| Inspector Fields Exposed by the NPrecisionMonobehavior

If you implement the NPrecisionMonobehavior the following fields will be added to your Inspector

...

Inspector Field

Description

Use Rigidbody

Toggles Whether you want the transformations on this NPrecision Monobehavior to run via the Rigidbody (Unity Physics)

Rigidbody

The Rigidbody component instance currently used for assigning transformations when ‘Use Rigidbody’ is active

Transform Precision

The current transform precision you want to use for this gameobject - default is floating point (32-bits) which will force the use of the regular ‘Transform’ component, if you set it to ‘Double’ (64-bits) the DTransform component will be automatically assigned

3| Creating a script that inherits NPrecisionMonobehavior

The following sample code explains how you can your own inheritant NPrecision Monobehavior Class:

...