---
tags:
    - "Quaternion"
    - "Difference"
    - "Between"
    - "Subtract"
    - "Offset"
    - "Inverse"
---

# Delta

[Math](index.md) / **Delta**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The rotation that has to be applied to the first value to reach the second one

## Parameters

| Name | Description |
| :--- | :---------- |
| From | The rotation the difference starts at |
| To | The rotation the difference ends at |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Delta")]
    [Category("Math/Delta")]

    [Description("The rotation that has to be applied to the first value to reach the second one")]
    [Image(typeof(IconQuaternion), ColorTheme.Type.Yellow, typeof(BadgeDelta))]

    [Parameter("From", "The rotation the difference starts at")]
    [Parameter("To", "The rotation the difference ends at")]

    [Keywords("Quaternion", "Difference", "Between", "Subtract", "Offset", "Inverse")]

    [Serializable]
    public class TypeQuaternionMathDelta : TypeQuaternion
    {
        [SerializeField] private GetQuaternion m_From = new GetQuaternion();
        [SerializeField] private GetQuaternion m_To = new GetQuaternion();

        public override Quaternion GetPreview(GameObject source)
        {
            return Quaternion.Inverse(this.m_From.GetPreview(source)) * this.m_To.GetPreview(source);
        }

        public override Quaternion Get(Args args)
        {
            return Quaternion.Inverse(this.m_From.Get(args)) * this.m_To.Get(args);
        }

        public override string ToString()
        {
            return $"{this.m_From} to {this.m_To}";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

