Files
XCEngine/docs/api/components/transform-component/rotate.md

30 lines
790 B
Markdown
Raw Normal View History

# Rotate
Rotate the transform by the specified angles.
## Syntax
```cpp
void Rotate(const Math::Vector3& eulers, Space relativeTo = Space::Self);
void Rotate(const Math::Vector3& axis, float angle, Space relativeTo = Space::Self);
```
## Parameters
- `eulers` - The Euler angles of rotation (x, y, z).
- `axis` - The axis of rotation.
- `angle` - The angle of rotation in degrees.
- `relativeTo` - Whether the rotation is relative to self or world space.
## Remarks
Applies a rotation to the transform. When `relativeTo` is `Space::Self`, the rotation is applied in local space. When `Space::World`, the rotation is applied in world space.
## Examples
```cpp
void Example(TransformComponent* transform) {
transform->Rotate(Math::Vector3(0.0f, 45.0f, 0.0f), Space::Self);
}
```