# Create Sensations

There are multiple ways of creating [sensations](/owo-api/welcome/what-is-a-sensation.md):

**Microsensation**

These are the smallest units that can be felt. A sensation is composed of one or more of them.

{% tabs %}
{% tab title="C#" %}

```csharp
var daggerEntry = SensationsFactory.Create(60, 0.1f, 90, 0, 0, 0);
var bleeding = SensationsFactory.Create(50, 0.5f, 50, 0, 0.4f, 0);
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto daggerEntry = SensationsFactory::Create(60, 0.1f, 90, 0, 0, 0);
auto bleeding = SensationsFactory::Create(50, 0.5f, 50, 0, 0.4f, 0);
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The parameters correspond with the following microsensation attributes:

1. Frequency
2. Duration (seconds)
3. Intensity (%)
4. Ramp up (seconds)
5. Ramp down (seconds)
6. Exit delay (seconds)
   {% endhint %}

**Sensations Sequence**

{% tabs %}
{% tab title="C#" %}

```csharp
var stab = daggerEntry.Append(bleeding);
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto stab = SensationsFactory::CreateSequence({ daggerEntry, bleeding });
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
All subtypes of `Sensation` can be chained together, so it would also be possible to chain Sensation sequences.
{% endhint %}

**Import a sensation**

Sensations are exported in its own format from the [Sensations Creator](/owo-api/tools/sensations-creator.md), you can import them using the `Parse` function.

{% hint style="info" %}
You can find the sensations code by opening the files (.owo) exported by the sensations creator. Otherwise you could load the file through code.&#x20;
{% endhint %}

{% tabs %}
{% tab title="C#" %}

```csharp
var ball = Sensation.Parse("100,1,100,0,0,0,Impact");
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto ball = SensationsParser::Parse("100,1,100,0,0,0,Impact");
```

{% endtab %}
{% endtabs %}

A baked sensation can be imported using the same function.

{% tabs %}
{% tab title="C#" %}

```csharp
var bakedBall = Sensation.Parse("0~Ball~100,1,100,0,0,0,Impact~impact-0~");
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto bakedBall = SensationsParser::Parse("0~Ball~100,1,100,0,0,0,Impact~impact-0~");
```

{% endtab %}
{% endtabs %}

### Muscles

#### Declaration

You can assign a muscle or group of muscles to any sensation. Muscles are defined like this:

{% tabs %}
{% tab title="C#" %}

```csharp
var rightPectoral = Muscle.Pectoral_R;
var bothPectorals = new Muscle[] { Muscle.Pectoral_R, Muscle.Pectoral_L };
var all = Muscle.All;
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto rightPectoral = Muscle::Pectoral_R();
auto bothPectorals = MusclesGroup({ Muscle::Pectoral_R(), Muscle::Pectoral_L() });
auto all = MusclesGroup::All();
```

{% endtab %}
{% endtabs %}

The intensity percentage can be changed per muscle:

{% tabs %}
{% tab title="C#" %}

```csharp
var atMinIntensity = rightPectoral.WithIntensity(1);
var eachWithItsOwnIntensity = new Muscle[] { Muscle.Pectoral_R.WithIntensity(25), 
                                             Muscle.Pectoral_L.WithIntensity(50) };
var atHighIntensity = Muscle.All.WithIntensity(80);
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto atMinIntensity = Muscle::Pectoral_R().WithIntensity(1);
auto eachWithItsOwnIntensity = MusclesGroup({ Muscle::Pectoral_R().WithIntensity(25), 
                                              Muscle::Pectoral_L().WithIntensity(25) });
auto atHighIntensity = MusclesGroup::All().WithIntensity(80);
```

{% endtab %}
{% endtabs %}

You can obtain the opposite muscles of a muscles group (or single) by calling the mirror method:

{% tabs %}
{% tab title="C#" %}

```csharp
var leftPectoral = Muscle.Pectoral_R.Mirror();
var rightSide = new[] { Muscle.Abdominal_L, Muscle.Pectoral_L, }.Mirror();
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto leftPectoral =  Muscle::Pectoral_R().Mirror();
auto rightSide = MusclesGroup({ Muscle::Abdominal_L(), Muscle::Lumbar_L(), Muscle::Pectoral_L() }).Mirror();
```

{% endtab %}
{% endtabs %}

#### Assignation

You can assign muscles to any subtype of `Sensation`.

{% tabs %}
{% tab title="C#" %}

```csharp
var ballWithMuscles = ball.WithMuscles(Muscle.Pectoral_R);
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto ballWithMuscles = ball->WithMuscles({ Muscle::Pectoral_R() });
```

{% endtab %}
{% endtabs %}

So it would be also possible to assign muscles to a sensations sequence, or to a baked sensation.

{% tabs %}
{% tab title="C#" %}

```csharp
var frontStab = stab.WithMuscles(Muscle.Abdominal_R);
var crossStab = daggerEntry.WithMuscles(Muscle.Abdominal_R)
                           .Append(bleeding.WithMuscles(Muscle.Dorsal_R));
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto frontStab = stab->WithMuscles({ Muscle::Abdominal_R() });
auto crossStab = SensationsFactory::CreateSequence({ daggerEntry->WithMuscles({Muscle::Abdominal_R()}), 
                                          bleeding->WithMuscles({Muscle::Dorsal_R()}) });
```

{% endtab %}
{% endtabs %}

After assigning muscles to a sensation, it becomes a `SensationWithMuscles`, and it will not be possible to override the muscles that were assigned to it initially.

{% tabs %}
{% tab title="C#" %}

```csharp
var ballWithMuscles = ball.WithMuscles(Muscle.Pectoral_R);
var keepingSameMuscles = ballWithMuscles.WithMuscles(Muscle.Lumbar_L); //Keeps only the right pectoral
```

{% endtab %}

{% tab title="C++" %}

```cpp
auto ballWithMuscles = ball->WithMuscles({ Muscle::Pectoral_R() });
auto keepingSameMuscles = ballWithMuscles->WithMuscles({ Muscle::Lumbar_L() }); //Keeps only the right pectoral
```

{% endtab %}
{% endtabs %}

You can use this as an advantage to define sensation sequences that have sensation with fixed muscles but others with dynamic muscles:

{% tabs %}
{% tab title="C#" %}

<pre class="language-csharp"><code class="lang-csharp"><strong>var incompleteStab = daggerEntry.WithMuscles(Muscle.Abdominal_R).Append(bleeding);
</strong><strong>var stabWithBackExit = crossStab.WithMuscles(Muscle.Dorsal_R); //The right dorsal will only be assigned to the bleeding
</strong></code></pre>

{% endtab %}

{% tab title="C++" %}

```cpp
auto incompleteStab = new SensationsSequence({ daggerEntry->WithMuscles({Muscle::Abdominal_R()}), bleeding});
auto stabWithBackExit = incompleteStab->WithMuscles({Muscle::Dorsal_R()}); //The right dorsal will only be assigned to the bleeding
```

{% endtab %}
{% endtabs %}

**Multiply intensity**

{% hint style="info" %}
This feature is only available in the .Net version of the API, it allows you to multiply the existing sensation of a muscle or sensation by a percentage.
{% endhint %}

Muscles

{% tabs %}
{% tab title="C#" %}

```csharp
// NOTE: The intensity of the muscle would be multiplied by 0.2f
var softer = Muscle.Abdominal_R.MultiplyIntensityBy(20);
```

{% endtab %}
{% endtabs %}

Sensations

{% tabs %}
{% tab title="C#" %}

<pre class="language-csharp"><code class="lang-csharp">// Microsensation with a intensity of 100
var higher = SensationFactory.Create(intensityPercentage: 25).MultiplyIntensityBy(400);
// Sensation with muscles with a intensity of 50
var half = SensationFactory.Create().WithMuscles(Arm_L).MultiplyIntensityBy(50);
// Sensation sequence with a intensity of 30
<strong>var softer = Sensation.Ball.WithMuscles(Abdominal_R).Append(Dart).MultiplyIntensityBy(30);
</strong></code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://owo-game.gitbook.io/owo-api/welcome/create-sensations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
