---
tags:
    - "Quaternion"
    - "Multiply"
    - "Add"
    - "Concatenate"
    - "Compose"
    - "Stack"
    - "Product"
---

# Combine

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

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Applies the second rotation on top of the first one

## Parameters

| Name | Description |
| :--- | :---------- |
| Rotation 1 | The rotation applied first |
| Rotation 2 | The rotation applied on top of the previous one |

## Code

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

namespace VisualScript.Runtime
{
    [Get]

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

    [Description("Applies the second rotation on top of the first one")]
    [Image(typeof(IconMultiplyCircle), ColorTheme.Type.Yellow, typeof(BadgeRotation))]

    [Parameter("Rotation 1", "The rotation applied first")]
    [Parameter("Rotation 2", "The rotation applied on top of the previous one")]

    [Keywords("Quaternion", "Multiply", "Add", "Concatenate", "Compose", "Stack", "Product")]

    [Serializable]
    public class TypeQuaternionMathCombine : TypeQuaternion
    {
        [SerializeField] private GetQuaternion m_Rotation1 = new GetQuaternion();
        [SerializeField] private GetQuaternion m_Rotation2 = new GetQuaternion();

        public override Quaternion GetPreview(GameObject source)
        {
            return this.m_Rotation1.GetPreview(source) * this.m_Rotation2.GetPreview(source);
        }

        public override Quaternion Get(Args args)
        {
            return this.m_Rotation1.Get(args) * this.m_Rotation2.Get(args);
        }

        public override string ToString()
        {
            return $"{this.m_Rotation1} * {this.m_Rotation2}";
        }

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

```

