> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/cyber-engine-tweaks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/movement-camera/adjusttransformwithdurations.md).

# AdjustTransformWithDurations

> ⚠️ All examples in this Observe/Override method `ShootEvents.OnEnter` to gain access to `stateContext`.

## `AdjustTransform`

Base class for `AdjustTransformWithDurations`. Seems to do nothing if passed to `adjustTransform` scriptable parameter. Do not use: your movement will be blocked indefinitely until you reset `adjustTransform`.

## `AdjustTransformWithDurations`

Discovered by void\*

Request to change player trajectory (view angles) and/or player position.

> This code has to be executed in the context where you have access to StateContext\
> for example: <https://nativedb.red4ext.com/ShootEvents#OnEnter>

Function has 3 types of behavior: set trajectory, set position or set both.

#### Changing player's trajectory to custom angles

This code will smoothly point your camera towards `{0, 0, 0}`.

```lua
local adjustRequest = AdjustTransformWithDurations.new();

-- Setting any duration to 0 or lower means "do not change"
-- Slide = change player position
-- Rotation = change player rotation / trajectory / viewing angles

adjustRequest:SetSlideDuration(-1.0); -- Disabling position adjustion
adjustRequest:SetRotationDuration(1); -- Rotation show be smooth and should happen in 1 second (presumably, second!)
adjustRequest:SetUseParabolicMotion(true); -- Do not just interpolate movement/rotation, use parabolic formula
adjustRequest:SetCurve(CName.new("None")); -- Setting curve to "None", no other curves were found in the sources
adjustRequest:SetRotation(ToEulerAngles {0, 0, 0}:ToQuat()); -- Setting target player's rotation

stateContext:SetTemporaryScriptableParameter("adjustTransform", adjustRequest, true);
```

<details>

<summary>How it looks in-game</summary>

<img src="https://i.imgur.com/iYdWnIZ.gif" alt="" data-size="original">

</details>

#### Targeting an `GameObject` for trajectory

> 1. <mark style="background-color:red;">**Does not change player's pitch.**</mark>
> 2. <mark style="background-color:red;">**Seems to target "nearest" targeting component (aka hitbox).**</mark>
> 3. <mark style="background-color:red;">**`SetRotation`**</mark><mark style="background-color:red;">**&#x20;**</mark><mark style="background-color:red;">**is ignored if target is set.**</mark>
> 4. <mark style="background-color:red;">**Will freeze player in place/in air while it's aiming (same behavior as**</mark> [**`LookAt`**](https://nativedb.red4ext.com/gametargetingTargetingSystem#LookAt)<mark style="background-color:red;">**)**</mark>

```lua
local adjustRequest = AdjustTransformWithDurations.new();
   
adjustRequest:SetSlideDuration(-1.0); -- Disabling position adjustion
adjustRequest:SetRotationDuration(1.0); -- Rotation show be smooth and should happen in ~1 second (presumably, seconds!)
adjustRequest:SetUseParabolicMotion(true); -- Do not just interpolate movement/rotation, use parabolic formula
adjustRequest:SetCurve(CName.new("None")); -- Setting curve to "None", no other curves were found in the sources
-- In this case aimAt is a GameObject
adjustRequest:SetTarget(aimAt); -- Setting target player's rotation

stateContext:SetTemporaryScriptableParameter("adjustTransform", adjustRequest, true);
```

This function seem to use TargetingSystem to find the "best component" and then calls a `LookAt`.

(Look at [this](https://nativedb.red4ext.com/gametargetingTargetingSystem#GetBestComponentOnTargetObject) function and [this](https://nativedb.red4ext.com/gametargetingTargetingSystem#LookAt) one)

<details>

<summary>How it looks in-game</summary>

![](https://i.imgur.com/YboE9uJ.gif)

</details>

#### Moving player

```lua
local adjustRequest = AdjustTransformWithDurations.new();
        
adjustRequest:SetSlideDuration(1.0); -- Setting duration of position change.
adjustRequest:SetRotationDuration(-1.0); -- Disabling rotation adjustion
adjustRequest:SetUseParabolicMotion(true); -- Do not just interpolate movement/rotation, use parabolic formula
adjustRequest:SetCurve(CName.new("None")); -- Setting curve to "None", no other curves were found in the sources

-- Getting player's position
local playerPosition = Game.GetPlayer():GetWorldPosition();
-- Adding 10 on the vertical axis
playerPosition.z = playerPosition.z + 10;

adjustRequest:SetPosition(playerPosition);

stateContext:SetTemporaryScriptableParameter("adjustTransform", adjustRequest, true);
```

<details>

<summary>How it looks in-game</summary>

![](https://i.imgur.com/rGlTkSW.gif)

</details>


---

# 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, and the optional `goal` query parameter:

```
GET https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/movement-camera/adjusttransformwithdurations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
